Closed zigi05 closed 2 years ago
Here are the logs when the server boots with tailwindcss@1.1.2:
and here are the logs with tailwindcss@2.2.9
So with v2.2.9, tailwindcss-intellisense throws this error Tailwind CSS: [object Object] is not a PostCSS plugin
.
This is a server bug,
When the server tries to dynamically register the completionProvider
capability, it sends these options:
{'triggerCharacters': ['"', "'", '`', ' ', '.', '[', '!', '/', None], 'id': 'fec37b14-50fd-4320-9a49-5646c22b8d58', 'resolveProvider': True}
If we look closer to the triggerCharacters
, we can notice None
in the array, which is not by the spec. triggerCharacters?: string[];
(link to the spec https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#completionOptions)
So how to fix it?
This should be further reported to the https://github.com/tailwindlabs/tailwindcss-intellisense repo.
I tried to update to the latest release of tailwindcss-intellisense
, from v0.6.15(current version that LSP-tailwindcss uses) to https://github.com/tailwindlabs/tailwindcss-intellisense/releases/tag/v0.7.0 just to see if it maybe fixed.
But (FWIW I successfully upgraded the server to v0.7.1 to https://github.com/sublimelsp/LSP-tailwindcss/pull/25)tailwindcss-intellisense v0.7.0
makes LSP-taiwlindcss not usable even when using tailwind-example
with tailwindcss@1.1.2
. (Which means that further issues to tailwindcss-intellisense
should be reported as well. )
I tried to filter out None
values from trigger chars,
but even then intellisense wont work, and it is probably due to this error:
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/predragnikolic/Documents/sandbox/tailwind-example/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/predragnikolic/Documents/sandbox/tailwind-example/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/predragnikolic/Documents/sandbox/tailwind-example/node_modules/postcss/lib/postcss.js:55:10)
at /home/predragnikolic/Documents/sandbox/tailwind-example/node_modules/tailwindcss/lib/util/parseObjectStyles.js:24:33
at arrayMap (/home/predragnikolic/Documents/sandbox/tailwind-example/node_modules/tailwindcss/node_modules/lodash/lodash.js:653:23)
at map (/home/predragnikolic/Documents/sandbox/tailwind-example/node_modules/tailwindcss/node_modules/lodash/lodash.js:9622:14)
at Function.flatMap (/home/predragnikolic/Documents/sandbox/tailwind-example/node_modules/tailwindcss/node_modules/lodash/lodash.js:9325:26)
at parseObjectStyles (/home/predragnikolic/Documents/sandbox/tailwind-example/node_modules/tailwindcss/lib/util/parseObjectStyles.js:23:26)
at parseObjectStyles (/home/predragnikolic/Documents/sandbox/tailwind-example/node_modules/tailwindcss/lib/util/parseObjectStyles.js:20:12)
at /home/predragnikolic/Documents/sandbox/tailwind-example/node_modules/tailwindcss/lib/util/processPlugins.js:41:123
Just to inform that since the update of LSP-taiwlindcss to v0.0.5 that uses tailwindcss-intellisense v0.7.1, my issue reported in this thread persists, and adds more to the error message mentioned above:
failed to register session LSP-tailwindcss to listener ViewListener(18)
Traceback (most recent call last):
File "C:\Users\zigi\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/windows.py", line 276, in _publish_sessions_to_listener_async
listener.on_session_initialized_async(session)
File "C:\Users\zigi\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/documents.py", line 219, in on_session_initialized_async
self._session_views[session.config.name] = SessionView(self, session, self._uri)
File "C:\Users\zigi\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/session_view.py", line 51, in __init__
session_buffer = SessionBuffer(self, buffer_id, uri)
File "C:\Users\zigi\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/session_buffer.py", line 87, in __init__
self.session.register_session_buffer_async(self)
File "C:\Users\zigi\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/sessions.py", line 942, in register_session_buffer_async
data.check_applicable(sb)
File "C:\Users\zigi\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/sessions.py", line 847, in check_applicable
self.registration_id, self.capability_path, self.registration_path, self.options)
File "C:\Users\zigi\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/session_buffer.py", line 151, in register_capability_async
sv.on_capability_added_async(registration_id, capability_path, options)
File "C:\Users\zigi\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/session_view.py", line 175, in on_capability_added_async
self._register_auto_complete_triggers(registration_id, trigger_chars or [])
File "C:\Users\zigi\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/session_view.py", line 96, in _register_auto_complete_triggers
self._apply_auto_complete_triggers(self.view.settings(), trigger_chars, registration_id)
File "C:\Users\zigi\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/session_view.py", line 130, in _apply_auto_complete_triggers
trigger["characters"] = "".join(trigger_chars)
I'm confused, do only I have this issue? How do others use it with Sublime Text 4 on Windows 10 then?
So I took a closer look,
We know that LSP-tailwindcss works with tailwindcss@1.1.2
.
If we bump to tailwindcss@2.2.9
in the workspace,
LSP-tailwindcss will log this error: Error: [object Object] is not a PostCSS plugin
.
And LSP-tailwindcss will stop working.
Based on this stack overflow thread https://stackoverflow.com/questions/40090111/postcss-error-object-object-is-not-a-postcss-plugin,
we also need to bump the postcss
dependency.
Try installing a newer version of postcss.
npm i -d postcss@8.3.9
That made the LSP-tailwindcss work for me with tailwindcss@2.2.9
.
@zigi05 let me know if this fixed your problem :-)
@zigi05 let me know if this fixed your problem :-)
Yes, I did fix it. You've been very helpful, thank you.
It works well in tailwind-example on my local machine, but it doesn't work in my project. The tailwind-example uses tailwindcss@1.1.2 and my project uses tailwindcss@2.2.9. Once I update tailwindcss to version 2.2.9 in tailwind-example, it stops working as well and I get the same error as in my project, so it seems not to be working with tailwindcss version at least 2.2+: