Sublime Forum

No autocomplete in template strings / source.css.embedded.js

#1

I don’t have any autocompletion on css-in-js.

const Root = styled.div`
  background: #f0f4f6;
  border-radius: 3px;
  vertical-align: center;
  :I'M HERE WITH MY CURSOR AND NOT AUTOCOMPLETE:
`
  "auto_complete_triggers": [
    {
      "selector": "text.html",
      "characters": "<"
    },
    {
      "selector": "source.css.embedded.js",
      "characters": "abcdefghijklmnopqrstuvwxyz"
    }
  ],
0 Likes

#2

The core JavaScript syntax that comes with Sublime does not provide any support for embedded CSS in templates. If you’re seeing the template contents highlighted as CSS, then you must be using a third-party syntax. There are two that I know of that support Styled Components templates: Babel and JS Custom. Babel has been around for a long time, but it hasn’t been updated in years and lags in quality and features. JS Custom (which — disclaimer — is my own project) is based directly on the core JavaScript syntax for compatibility and is actively maintained. If you are using JS Custom, and autocomplete inside custom templates is not working as expected, then if you open up an issue on the tracker then I’ll try to get to it ASAP.

0 Likes

#3

I’m using Naomi.

I opened an issue.

Thank you for your answer @ThomSmith!

0 Likes