sublimelsp / LSP-tailwindcss

Tailwind css support for Sublime's LSP plugin
MIT License
54 stars 5 forks source link

Tailwindcss support in strings? #53

Closed predrag-codetribe closed 1 year ago

predrag-codetribe commented 1 year ago

How to get autocomplete in regular strings?

let regularString = ''
predrag-codetribe commented 1 year ago

One way to do it is to use tailwindCSS.experimental.classRegex in LSP-tailwindcss.sublime-settings:

{
  "settings": { 
    "tailwindCSS.experimental.classRegex": ["\\/\\*\\s?tw\\s?\\*\\/\\s?'(.*)'"] 
  }
}

That will allow to have autocomplte in strings that start with /tw/:

let regularString = /*tw*/'' // <- now you have autocomplete
predrag-codetribe commented 1 year ago

For you use a function like classnames, use the following regex:

"tailwindCSS.experimental.classRegex": [
  ["classnames\\(([^)]*)\\)", "'([^']*)'"]
]

that will enable autocomplite in strings like:

const cn = classnames('', className)