sublimelsp / LSP-tailwindcss

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

Nothing happens only on Elixir Files/Templates #56

Closed gdgp closed 1 year ago

gdgp commented 1 year ago

Hi!

I'm having an issue in which it runs perfectly in say, an HTML file (autocomplete, hover information, etc), but in Elixir template files (e.g. eex, heex, leex or even in some ex with html information in them) it does not. I can see that the language server is triggered in the status bar, but nothing happens.

Strange part is that if I rename the file to for example an html or a php and reopen it, it works perfectly.

From looking into this closed issue I don't think I would need any special configuration. But, I've tried specifically adding it and some other includeLanguages, for the several different combinations, etc, but no luck -- to be fair, I already see the language server triggered.

The only message I see in the console log (even with LSP debug mode enabled), but which I think is not related since it also appears in the case I renamed it to an extension where it works is:

Found styles linked in HTML
[]

Any clue what the issue could be?

Thanks in advance

predragnikolic commented 1 year ago

Hello, Can you provide steps to reproduce it?

gdgp commented 1 year ago

Hi @predragnikolic

Of course, I just created a sample project where the same happens to me. Some notes on it:

Works:

Screenshot 2023-02-28 at 09 32 46

Does not work:

Screenshot 2023-02-28 at 09 31 09
rchl commented 1 year ago

What's the root scope of that EEx syntax? You can see by triggering menu: Tools -> Developer -> Show scope name.

I think this can be handled either by adding a mapping for the language id in userLanguages initialization setting (https://github.com/sublimelsp/LSP-tailwindcss/issues/51#issuecomment-1329749851) or adding a global mapping in the LSP package.

gdgp commented 1 year ago

The scope is text.html.eex, I've played around with the mapping you mentioned but I was not successfull.

Latest attempt a bit all over the place:

  1. LSP-tailwindcss.sublime-settings:
    
    // Settings in here override those in "LSP-tailwindcss/LSP-tailwindcss.sublime-settings"

{ "settings": { "tailwindCSS.includeLanguages": { "text.html.eex": "html" }, }, "selector": "source.jsx | source.js.react | source.js | source.tsx | source.ts | source.css | source.scss | source.less | text.html.vue | text.html.svelte | text.html.basic | text.html.twig | text.blade | text.html.blade | embedding.php | text.html.rails | text.html.erb | text.haml | text.jinja | text.django | text.html.elixir | text.html.eex" }


2. LSP.sublime-settings (sorry I'm not sure what I'm doing here so just tried several): 
```json
// Settings in here override those in "LSP/LSP.sublime-settings"
{
  "lsp_format_on_save": true,
  "log_debug": false,
  "initializationOptions": {
        "userLanguages": {
            "tailwind": "css",
            "tailwind": "text.html.eex",
            "text.html.eex": "html"
        },
    },
}
rchl commented 1 year ago

Try:

Screenshot 2023-02-28 at 12 26 11

// SublimeText base scope -> LSP Language ID overrides
{
    "text.html.eex": "html"
}
gdgp commented 1 year ago

@rchl thanks!

For the reference I added:

// SublimeText base scope -> LSP Language ID overrides
{
  "text.html.eex": "html",
  "text.html.heex": "html",
  "text.html.leex": "html"
}

Which finally worked paired with appending to the selector | text.html.eex | text.html.leex | text.html.heex:

// Settings in here override those in "LSP-tailwindcss/LSP-tailwindcss.sublime-settings"
{
  "selector": "source.jsx | source.js.react | source.js | source.tsx | source.ts | source.css | source.scss | source.less | text.html.vue | text.html.svelte | text.html.basic | text.html.twig | text.blade | text.html.blade | embedding.php | text.html.rails | text.html.erb | text.haml | text.jinja | text.django | text.html.elixir | text.html.eex | text.html.leex | text.html.heex"
}

Thanks a lot for the quick help @rchl and @predragnikolic