Closed countfak closed 3 years ago
Hello, Glad you like it.
This plugin LSP-tailwindcss which uses the https://github.com/tailwindlabs/tailwindcss-intellisense language server. The language server supports multiple languages. But currently LSP-tailwindcss is configured to work with these languages
:
https://github.com/sublimelsp/LSP-tailwindcss/blob/master/LSP-tailwindcss.sublime-settings#L3-L64
From the command palette, you can choose Preferences: LSP-tailwindcss Settings
and add to the languages
your twig language configuration. (you can create a PR once you made it work for you)
Can you tell me what you Sublime Text version is and what syntax highlighter plugin you use for Twig?
Hi, thanks for your help, I got it working. I edited the first part of the "languages" setting as follow:
{
"languageId": "html",
"scopes": ["text.html.basic", "embedding.php", "text.blade", "text.html.twig"],
"syntaxes": [
"Packages/HTML/HTML.sublime-syntax",
"Packages/PHP/PHP.sublime-syntax",
"Packages/Laravel Blade Highlighter/blade.sublime-syntax",
"Packages/Twig/Twig.sublime-syntax"
]
}
To recap, in the "languageId": "html" block, that's what I did:
I'm on Sublime Text 4109 The package I use for the Twig syntax is BetterTwig: https://packagecontrol.io/packages/Twig
Thanks,
For Sublime Text 3 the syntaxes
key is required,
while for Sublime Text 4 it is not. (For ST4 the scopes
key is sufficient)
FWIW to get the sytnax, you can open up the ST console with ctrl+` and paste:
>>> view.settings().get('syntax')
'Packages/Twig/resources/syntax/Twig.sublime-syntax'
I will create a PR to add twig support.
Because I am not sure what languages the tailwindcss language server supports I opened an issue where I asked that question: https://github.com/tailwindlabs/tailwindcss-intellisense/issues/360#issue-930532711
Who is still using ST3 though? Why put effort into supporting that?
lsp_utils
does most of the work.
But I was thinking about this lately and I do not see a reason why would someone not want to install ST 4 and I can't think of any reasons.
I think that anyone can install ST4 stable without a license and use it, though they will probably get popups to buy the license.
But on the other side, I really do not want to maintain the syntaxes
key. :)
That said, I think that I should slowly move on forward and only support ST4.
I'd like to be the voice of pragmatism here and maintain ST3 support for as long as possible. :)
Adding a syntax entry is a close to zero effort when you have to figure out the correct selector to use anyway.
Hi, I just got this Package Control message this morning and I thought it might be interesting:
BetterTwig v2.0.0
-----------------
** Breaking Changes **
- Note that even though this is a major version upgrade, the only breaking change
in this release is that the syntax name is changed from "Twig.sublime-syntax"
to "HTML (Twig).sublime-syntax". This is done to better reflect the fact that
the Twig syntax now extends HTML syntax to provide highlighting for both Twig
& HTML specific code. If you are referring the syntax by its name for any purpose,
then please change it to "HTML (Twig).sublime-syntax".
Basically, it says that the syntax name is changed from "Twig.sublime-syntax" to "HTML (Twig).sublime-syntax". Everything is still working fine for me, but maybe the syntax name in the package settings should be updated?
Thanks, for the heads-up, Will update that.
will be done in #32
Thanks for the great extension.
For regular HTML files, it works great. However, the extension stops working completely once a file is associated to another file type.
For example, Twig template files use the regular .html extension but include special mustache {{ }} syntax. I'm using another extension to get tag highlighting for these files. But once I associate this file as "Twig" LSP-tailwindcss does not work.
Anything I'm missing?