sublimelsp / LSP-tailwindcss

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

doesn't start when editing TSX files #27

Closed eidellev closed 2 years ago

eidellev commented 2 years ago

Thanks for this great package :-) It seems to work great when I'm editing CSS or HTML, but I can't get it to work in my react/typescript components. I'm assuming this has something to do with syntax/languageId defintions, but I can't figure out what it is.

Thanks in advance!

I'm on ST4 build 4121

eidellev commented 2 years ago

As always, the solution presents itself the moment I open an issue ..😄 This is what I needed to add to my config:

{
  "languageId": "typescriptreact",
  "scopes": ["source.tsx"],
  "syntaxes": [
    "Packages/JavaScript/TSX.sublime-syntax",
    ],
},

Should I perhaps open a PR for this?

rchl commented 2 years ago

I'll have a look. I've probably regressed this when changing the lsp_utils dependency. The actual fix should be a bit different but feel free to use yours.

eidellev commented 2 years ago

Awesome, thanks a lot!

predragnikolic commented 2 years ago

Strange that the existing config didn't work https://github.com/sublimelsp/LSP-tailwindcss/blob/c75ac235cbb4107133808464bf1b81bd6d7929f3/LSP-tailwindcss.sublime-settings#L62

rchl commented 2 years ago

There is some code in LSP that handles the ST3-style configuration but it's not as robust as the code we had in lsp_utils and only works based on syntaxes in this case - https://github.com/sublimelsp/LSP/blob/7a9b8a64ef470de2f3c655626d44741a8105c186/plugin/core/types.py#L883-L890

And since the syntaxes defined here don't match ST4, it doesn't work.