Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwind language server shows errors #2213

Closed
volucris1 opened this issue Apr 21, 2022 · 72 comments · Fixed by tailwindlabs/tailwindcss-intellisense#656
Closed

Tailwind language server shows errors #2213

volucris1 opened this issue Apr 21, 2022 · 72 comments · Fixed by tailwindlabs/tailwindcss-intellisense#656

Comments

@volucris1
Copy link

Helix showing me this:

Async job failed: protocol error: Method not found: Unhandled method textDocument/completion

And there is my languages.toml

[[language]]
name = "tailwind"
scope = "source.svelte"
roots = [".npmrc"]
file-types = ["svelte"]
language-server = { command = "/home/yura/.local/share/nvim/lsp_servers/tailwindcss_npm/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server", args = ["--stdio"] }
@the-mikedavis
Copy link
Member

It looks like the tailwind LS has a troubleshooting section here: https://github.com/tailwindlabs/tailwindcss-intellisense#troubleshooting and some available configuration above. You can also run in verbose mode with the -v flags (up to three of them) and check what messages are passed between the LS and helix https://github.com/helix-editor/helix/wiki/FAQ#access-the-log-file

@hucancode
Copy link

I got the same error

Screenshot_2022-05-29-11-23-40_1920x1080
My language.toml

[[language]]
name = "tailwindcss"
scope = "source.css"
injection-regex = "(postcss|css)"
file-types = ["css"]
roots = ["tailwind.config.js","tailwind.config.cjs"]
comment-token = "//"
language-server = { command = "tailwindcss-language-server", args = ["--stdio"] }
indent = { tab-width = 2, unit = "  " }

Log

2022-05-29T11:10:20.964 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:10:38.529 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:10:43.390 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:10:45.230 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:13:25.795 helix_view::theme [WARN] Theme: malformed hexcode: delta
2022-05-29T11:13:25.795 helix_view::theme [WARN] Theme: malformed hexcode: lightning
2022-05-29T11:13:25.795 helix_view::theme [WARN] Theme: malformed hexcode: apricot
2022-05-29T11:13:25.795 helix_view::theme [WARN] Theme: malformed hexcode: silver
2022-05-29T11:13:35.898 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:13:39.860 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:13:39.872 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:13:43.597 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:13:44.103 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:14:33.681 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:14:43.788 helix_view::theme [WARN] Theme: malformed hexcode: delta
2022-05-29T11:14:43.788 helix_view::theme [WARN] Theme: malformed hexcode: silver
2022-05-29T11:14:43.788 helix_view::theme [WARN] Theme: malformed hexcode: apricot
2022-05-29T11:14:43.788 helix_view::theme [WARN] Theme: malformed hexcode: lightning
2022-05-29T11:14:43.794 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":false},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"publishDiagnostics":{},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":false}},"window":{"workDoneProgress":true},"workspace":{"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"workspaceFolders":true}},"processId":26443,"rootPath":"/home/hucancode/Documents/unagi-store/web","rootUri":"file:///home/hucancode/Documents/unagi-store/web","workspaceFolders":[{"name":"web","uri":"file:///home/hucancode/Documents/unagi-store/web"}]},"id":0}
2022-05-29T11:14:43.932 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":0,"method":"workspace/configuration","params":{"items":[{"section":"editor"}]}}
2022-05-29T11:14:43.932 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":1,"method":"workspace/configuration","params":{"items":[{"section":"tailwindCSS"}]}}
2022-05-29T11:14:43.932 helix_lsp::transport [INFO] Language server not initialized, delaying request
2022-05-29T11:14:43.932 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":1,"hoverProvider":true,"colorProvider":true,"codeActionProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":["\"","'","`"," ",".","[","!","/",":"]}}}}
2022-05-29T11:14:43.932 helix_lsp::transport [INFO] <- {"capabilities":{"codeActionProvider":true,"colorProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":["\"","'","`"," ",".","[","!","/",":"]},"hoverProvider":true,"textDocumentSync":1}}
2022-05-29T11:14:43.932 helix_lsp::transport [INFO] Draining pending message Response(Success(Success { jsonrpc: Some(V2), result: Array([Null]), id: Num(0) }))
2022-05-29T11:14:43.932 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":[null],"id":0}
2022-05-29T11:14:43.933 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialized","params":{}}
2022-05-29T11:14:43.933 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":[null],"id":1}
2022-05-29T11:14:43.933 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"css","text":"body {\n  @apply w-ful\n}\n","uri":"file:///home/hucancode/Documents/unagi-store/web/test.css","version":0}}}
2022-05-29T11:14:43.938 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":1,"message":"Unhandled exception: Cannot read properties of undefined (reading 'userLanguages')\nTypeError: Cannot read properties of undefined (reading 'userLanguages')\n    at /usr/lib/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:57:415664\n    at Generator.next (<anonymous>)\n    at fulfilled (/usr/lib/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:57:413506)"}}
2022-05-29T11:14:43.938 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Error, message: "Unhandled exception: Cannot read properties of undefined (reading 'userLanguages')\nTypeError: Cannot read properties of undefined (reading 'userLanguages')\n    at /usr/lib/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:57:415664\n    at Generator.next (<anonymous>)\n    at fulfilled (/usr/lib/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:57:413506)" }
2022-05-29T11:14:46.209 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":14,"line":1},"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css"}},"id":1}
2022-05-29T11:14:46.210 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Unhandled method textDocument/completion"}}
2022-05-29T11:14:46.210 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:14:46.842 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css","version":1}}}
2022-05-29T11:14:47.244 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":15,"line":1},"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css"}},"id":2}
2022-05-29T11:14:47.245 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":2,"error":{"code":-32601,"message":"Unhandled method textDocument/completion"}}
2022-05-29T11:14:47.245 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:14:52.103 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full \n}\n"}],"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css","version":2}}}
2022-05-29T11:14:52.104 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css"}},"id":3}
2022-05-29T11:14:52.104 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":3,"error":{"code":-32601,"message":"Unhandled method textDocument/completion"}}
2022-05-29T11:14:52.104 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:14:52.544 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css","version":3}}}
2022-05-29T11:14:52.657 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h-\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css","version":4}}}
2022-05-29T11:14:53.384 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h-f\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css","version":5}}}
2022-05-29T11:14:53.423 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h-fu\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css","version":6}}}
2022-05-29T11:14:53.824 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":20,"line":1},"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css"}},"id":4}
2022-05-29T11:14:53.825 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":4,"error":{"code":-32601,"message":"Unhandled method textDocument/completion"}}
2022-05-29T11:14:53.825 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:14:59.860 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h-fu\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css","version":7}}}
2022-05-29T11:15:00.021 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h-fu\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/Documents/unagi-store/web/test.css","version":8}}}
2022-05-29T11:19:22.480 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"shutdown","params":null,"id":5}
2022-05-29T11:19:22.481 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":5,"result":null}
2022-05-29T11:19:22.481 helix_lsp::transport [INFO] <- null
2022-05-29T11:19:22.481 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"exit","params":null}
2022-05-29T11:21:45.732 helix_view::theme [WARN] Theme: malformed hexcode: silver
2022-05-29T11:21:45.732 helix_view::theme [WARN] Theme: malformed hexcode: lightning
2022-05-29T11:21:45.732 helix_view::theme [WARN] Theme: malformed hexcode: delta
2022-05-29T11:21:45.732 helix_view::theme [WARN] Theme: malformed hexcode: apricot
2022-05-29T11:21:45.736 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":false},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"publishDiagnostics":{},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":false}},"window":{"workDoneProgress":true},"workspace":{"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"workspaceFolders":true}},"processId":26821,"rootPath":"/home/hucancode","rootUri":"file:///home/hucancode","workspaceFolders":[{"name":"hucancode","uri":"file:///home/hucancode"}]},"id":0}
2022-05-29T11:21:45.875 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":0,"method":"workspace/configuration","params":{"items":[{"section":"editor"}]}}
2022-05-29T11:21:45.875 helix_lsp::transport [INFO] Language server not initialized, delaying request
2022-05-29T11:21:45.875 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":1,"method":"workspace/configuration","params":{"items":[{"section":"tailwindCSS"}]}}
2022-05-29T11:21:45.875 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":1,"hoverProvider":true,"colorProvider":true,"codeActionProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":["\"","'","`"," ",".","[","!","/",":"]}}}}
2022-05-29T11:21:45.875 helix_lsp::transport [INFO] <- {"capabilities":{"codeActionProvider":true,"colorProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":["\"","'","`"," ",".","[","!","/",":"]},"hoverProvider":true,"textDocumentSync":1}}
2022-05-29T11:21:45.875 helix_lsp::transport [INFO] Draining pending message Response(Success(Success { jsonrpc: Some(V2), result: Array([Null]), id: Num(0) }))
2022-05-29T11:21:45.875 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":[null],"id":0}
2022-05-29T11:21:45.875 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialized","params":{}}
2022-05-29T11:21:45.875 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":[null],"id":1}
2022-05-29T11:21:45.875 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"css","text":"\n","uri":"file:///home/hucancode/test.css","version":0}}}
2022-05-29T11:21:45.880 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":1,"message":"Unhandled exception: Cannot read properties of undefined (reading 'userLanguages')\nTypeError: Cannot read properties of undefined (reading 'userLanguages')\n    at /usr/lib/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:57:415664\n    at Generator.next (<anonymous>)\n    at fulfilled (/usr/lib/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:57:413506)"}}
2022-05-29T11:21:45.880 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Error, message: "Unhandled exception: Cannot read properties of undefined (reading 'userLanguages')\nTypeError: Cannot read properties of undefined (reading 'userLanguages')\n    at /usr/lib/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:57:415664\n    at Generator.next (<anonymous>)\n    at fulfilled (/usr/lib/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:57:413506)" }
2022-05-29T11:21:49.881 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"b\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":1}}}
2022-05-29T11:21:49.937 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"bo\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":2}}}
2022-05-29T11:21:50.186 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"bod\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":3}}}
2022-05-29T11:21:50.241 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":4}}}
2022-05-29T11:21:50.563 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body \n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":5}}}
2022-05-29T11:21:50.563 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":5,"line":0},"textDocument":{"uri":"file:///home/hucancode/test.css"}},"id":1}
2022-05-29T11:21:50.564 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Unhandled method textDocument/completion"}}
2022-05-29T11:21:50.564 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:21:51.000 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":6}}}
2022-05-29T11:21:51.241 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  \n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":7}}}
2022-05-29T11:21:52.220 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":8}}}
2022-05-29T11:21:52.633 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @a\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":9}}}
2022-05-29T11:21:52.684 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @ap\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":10}}}
2022-05-29T11:21:52.857 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @app\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":11}}}
2022-05-29T11:21:53.062 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @appl\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":12}}}
2022-05-29T11:21:53.142 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":13}}}
2022-05-29T11:21:53.483 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply \n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":14}}}
2022-05-29T11:21:53.483 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":9,"line":1},"textDocument":{"uri":"file:///home/hucancode/test.css"}},"id":2}
2022-05-29T11:21:53.483 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":2,"error":{"code":-32601,"message":"Unhandled method textDocument/completion"}}
2022-05-29T11:21:53.483 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:22:02.002 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":15}}}
2022-05-29T11:22:02.137 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":16}}}
2022-05-29T11:22:02.370 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-f\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":17}}}
2022-05-29T11:22:02.486 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-fu\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":18}}}
2022-05-29T11:22:02.691 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-ful\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":19}}}
2022-05-29T11:22:02.851 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":20}}}
2022-05-29T11:22:03.252 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":15,"line":1},"textDocument":{"uri":"file:///home/hucancode/test.css"}},"id":3}
2022-05-29T11:22:03.253 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":3,"error":{"code":-32601,"message":"Unhandled method textDocument/completion"}}
2022-05-29T11:22:03.253 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:22:03.481 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-fullh\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":21}}}
2022-05-29T11:22:03.617 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-fullh \n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":22}}}
2022-05-29T11:22:03.617 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":17,"line":1},"textDocument":{"uri":"file:///home/hucancode/test.css"}},"id":4}
2022-05-29T11:22:03.618 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":4,"error":{"code":-32601,"message":"Unhandled method textDocument/completion"}}
2022-05-29T11:22:03.618 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:22:03.974 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-fullh\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":23}}}
2022-05-29T11:22:04.114 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":24}}}
2022-05-29T11:22:04.408 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full \n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":25}}}
2022-05-29T11:22:04.408 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///home/hucancode/test.css"}},"id":5}
2022-05-29T11:22:04.408 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":5,"error":{"code":-32601,"message":"Unhandled method textDocument/completion"}}
2022-05-29T11:22:04.408 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:22:04.504 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":26}}}
2022-05-29T11:22:04.633 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h-\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":27}}}
2022-05-29T11:22:05.313 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h-f\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":28}}}
2022-05-29T11:22:05.354 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h-fu\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":29}}}
2022-05-29T11:22:05.755 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":20,"line":1},"textDocument":{"uri":"file:///home/hucancode/test.css"}},"id":6}
2022-05-29T11:22:05.755 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h-ful\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":30}}}
2022-05-29T11:22:05.756 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":6,"error":{"code":-32601,"message":"Unhandled method textDocument/completion"}}
2022-05-29T11:22:05.756 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:22:05.911 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"text":"body {\n  @apply w-full h-full\n}\n"}],"textDocument":{"uri":"file:///home/hucancode/test.css","version":31}}}
2022-05-29T11:22:06.313 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":22,"line":1},"textDocument":{"uri":"file:///home/hucancode/test.css"}},"id":7}
2022-05-29T11:22:06.313 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":7,"error":{"code":-32601,"message":"Unhandled method textDocument/completion"}}
2022-05-29T11:22:06.313 helix_lsp::transport [ERROR] <- Method not found: Unhandled method textDocument/completion
2022-05-29T11:24:12.480 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"shutdown","params":null,"id":8}
2022-05-29T11:24:12.481 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":8,"result":null}
2022-05-29T11:24:12.481 helix_lsp::transport [INFO] <- null
2022-05-29T11:24:12.481 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"exit","params":null}

@gasacchi
Copy link

gasacchi commented Sep 8, 2022

any info for this? not working and even broke svelte syntax highlighting and completions

my languages.toml file:

[[language]]
name = "tailwind"
scope = "source.svelte"
file-types = ["svelte"]
roots = ["tailwind.config.js","tailwind.config.cjs"]
language-server = { command = "tailwindcss-language-server", args = ["--stdio"] }

@aguilera51284

This comment was marked as spam.

@anbcodes
Copy link

anbcodes commented Nov 8, 2022

I looked into this some, it appears that the tailwindcss language server expects the config to be an object, and so crashes when a config is not provided, which means the language server never registers the textDocument/completion handler.

Here are the specific lines

      userLanguages: params.initializationOptions.userLanguages
        ? params.initializationOptions.userLanguages
        : {},

Tailwindcss never checks to make sure initializationOptions is in fact an object.

My configuration file that does not produce that error looks like this

[[language]]
name = "tailwindcss"
scope = "source.css"
injection-regex = "(postcss|css|html)"
file-types = ["css"]
roots = ["tailwind.config.js","tailwind.config.cjs"]
language-server = { command = "tailwindcss-language-server", args = ["-vvv", "--stdio"] }
indent = { tab-width = 2, unit = "  " }
config = { } # <---- this is the partial fix

But even though the error went away (and the logs show the language server working), it's still not giving completions. (The server keeps returning null for the list of completions)

2022-11-08T16:06:58.671 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///home/andrew/Code/js/spry/landing-svelte/src/routes/+page.svelte"}},"id":4}
2022-11-08T16:06:58.674 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":4,"result":null}

I haven't figured the issue out, but I thought I would write down what I've discovered so far.

Update: In a .postcss file after setting the language to tailwindcss, autocomplete works, it is just in svelte that it isn't working

Update 2:

I solved it! Tailwindcss determines which type of file you are in based on the language-id parameter, so a working configuration for svelte files (only) is below.

[[language]]
name = "tailwind-svelte"
scope = "source.svelte"
file-types = ["svelte"]
roots = ["tailwind.config.js","tailwind.config.cjs"]
language-server = { language-id = "svelte", command = "tailwindcss-language-server", args = ["--stdio"] }
config = { }

You need to modify each language tailwindcss works with and overwrite it with tailwindcss and the correct language-id. Unfortunately, this overwrites the existing language server for all those languages. Until #2507 is merged, there isn't a way to add two language servers to the same language. Once that PR is merged a configuration file for tailwindcss (for Svelte, CSS, and HTML) would look like this (which is the config I am currently using after building the PR myself).

[[language]]
name = "svelte"
scope = "source.svelte"
file-types = ["svelte"]
roots = ["tailwind.config.js","tailwind.config.cjs"]
language-servers = [ "tailwindcss-svelte", "svelteserver" ]

[language-server.tailwindcss-svelte]
language-id = "svelte"
command = "tailwindcss-language-server"
args = ["--stdio"]
config = { }

[[language]]
name = "css"
scope = "source.css"
file-types = ["css", "postcss"]
language-servers = [ "tailwindcss-css", "vscode-css-language-server" ]

[language-server.tailwindcss-css]
language-id = "css"
command = "tailwindcss-language-server"
args = ["--stdio"]
config = { }

[[language]]
name = "html"
scope = "text.html.basic"
file-types = ["html"]
language-servers = [ "tailwindcss-html", "vscode-html-language-server" ]

[language-server.tailwindcss-html]
language-id = "html"
command = "tailwindcss-language-server"
args = ["--stdio"]
config = { }

@anbcodes
Copy link

anbcodes commented Nov 9, 2022

Once tailwindlabs/tailwindcss-intellisense#656 is released the config will be able to be empty without causing tailwind to crash, which fixes this bug.

@H4ckint0sh
Copy link

Any news on this. Should it work now? I am not able to use this.

@uros-5
Copy link

uros-5 commented Jan 6, 2023

Current problem is that with #2507, hover doesn't work if tailwindcss is not first language added to language-servers..

When Svelte or Vue are second in that array then their features are not working.

I tried to change that, and it works 😃

My temp fork.

@arnm
Copy link

arnm commented Mar 30, 2023

Anyone do this with tsx files ?

@aliade-consid
Copy link

@arnm Did you found any solutions?

@gigantino
Copy link

Now that it has been merged did someone experiment already with TSX and Tailwind?
This was my current attempt but I'm most likely doing something wrong:

[[language]]
name = "typescript"
roots = ["tailwind.config.js", "tailwind.config.cjs"]
language-servers = [ "tailwindcss-typescript", "typescript-language-server" ]

[language-server.tailwindcss-typescript]
language-id = "typescript"
command = "tailwindcss-language-server"
args = ["--stdio"]
config = { }

@happysalada
Copy link
Contributor

I'm trying with

[[language]]
language-servers = ["svelteserver", "tailwindcss"]
name = "svelte"
roots = ["tailwind.config.cjs", "tailwind.config.js"]

[language-server.rust-analyzer]
command = "/nix/store/gz8ifn0klcfccnksnpn2y8sc1qsq4f28-rust-analyzer-unwrapped-2023-05-15/bin/rust-analyzer"

[language-server.svelteserver]
command = "/nix/store/vh8zkvwr23mmbiqpkwgqy6dxp8q1kilv-svelte-language-server-0.15.10/bin/svelteserver"

[language-server.tailwindcss]
args = ["--stdio"]
command = "/nix/store/64cg3zg014l1xx5667ix4aq2k7m84ick-_at_tailwindcss_slash_language-server-0.0.13/bin/tailwindcss-language-server"

(with the master branch and it's not working at all. Curious if anyone can share a working configuration).

@uros-5
Copy link

uros-5 commented May 20, 2023

I'm trying with

[[language]]
language-servers = ["svelteserver", "tailwindcss"]
name = "svelte"
roots = ["tailwind.config.cjs", "tailwind.config.js"]

[language-server.rust-analyzer]
command = "/nix/store/gz8ifn0klcfccnksnpn2y8sc1qsq4f28-rust-analyzer-unwrapped-2023-05-15/bin/rust-analyzer"

[language-server.svelteserver]
command = "/nix/store/vh8zkvwr23mmbiqpkwgqy6dxp8q1kilv-svelte-language-server-0.15.10/bin/svelteserver"

[language-server.tailwindcss]
args = ["--stdio"]
command = "/nix/store/64cg3zg014l1xx5667ix4aq2k7m84ick-_at_tailwindcss_slash_language-server-0.0.13/bin/tailwindcss-language-server"

(with the master branch and it's not working at all. Curious if anyone can share a working configuration).

Try to add in: [language-server.tailwindcss]

language-id = "svelte"
config = { }

@happysalada
Copy link
Contributor

Ive tried and infortunately it didnt work for me
Ive also tried putting tailwindcss before svelteserver but that didnt do better either.
Thank you for the suggestion though !

@gigantino
Copy link

@Philipp-M are we doing something wrong?

@Philipp-M
Copy link
Contributor

Don't have much time right now...

language-id is a language specific element (a language-server can support multiple different languages). So this should be under the relevant language svelte, but by default if language-id under the language isn't defined, the name attribute is used instead.

What may give some insight is running helix with the verbose flag (-v) and checking the logs (in linux ~/.cache/helix/helix.log).

For tsx the language-id that is used by default is typescriptreact which follows the recommendation in https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem

@happysalada
Copy link
Contributor

Thanks for your comment!

Just to add a couple of elements

  • I added a PR with the settings for tailwind which I'm using to test language-server: add tailwindcss language-server #7080
  • I've tried running tailwind with -vvv but nothing shows up about tailwindcss language server and nothing at all shows up in the logs. (I've verified that the binary path is actually correct).

I'm going to try another lsp that would benefit from being run side by side with another one. I'll report if I can make that one work.

@hamrik
Copy link
Contributor

hamrik commented May 21, 2023

Tested the following configuration in project/.helix/languages.toml and both servers appear to work:

[[language]]
name = "svelte"
language-servers = ["svelteserver", "tailwindcss"]
roots = ["tailwind.config.cjs", "tailwind.config.js"]

[language-server.svelteserver]
command = "node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server"

[language-server.tailwindcss]
language-id = "svelte"
command = "node_modules/svelte-language-server/bin/server.js"
args = ["--stdio"]

@uros-5
Copy link

uros-5 commented May 21, 2023

TailwindLSP was working for me on node v16. On v18 not so much.
I tried to debug it(this branch)
Helix doesn't respond to these two requests:

2023-05-21T18:18:29.678 helix_lsp::transport [INFO] tailwindcss-vue <- {"jsonrpc":"2.0","id":0,"method":"workspace/configuration","params":{"items":[{"section":"editor"}]}}
2023-05-21T18:18:29.678 helix_lsp::transport [INFO] tailwindcss-vue <- {"jsonrpc":"2.0","id":1,"method":"workspace/configuration","params":{"items":[{"section":"tailwindCSS"}]}}

I tried to stop these two requests and insert default values(from other editors) and it works(Linux) for React, Vue and Svelte 😃

tw

npm
npm i helix-twcss -g

#other language servers and languages
...
# tailwind react
[language-server.tailwindcss-react]
language-id = "javascriptreact"
command = "hx-tw"
config = { }
args = ["--stdio"]
timeout = 3

# tailwind vue
[language-server.tailwindcss-vue]
language-id = "vue"
command = "hx-tw"
args = ["--stdio"]
timeout = 5

[[language]]
name = "vue"
scope = "source.vue"
file-types = ["vue"]
roots = ["package.json", "tailwind.config.js","tailwind.config.cjs", ".prettierrc.json"]
language-servers = ["volar","tailwindcss-vue"]
injection-regex = "vue"
formatter = {command = "prettier", args = ["--parser", "vue"]}
auto-format = true

[[language]]
name = "tsx"
language-servers = ["tailwindcss-react", "tsreact"]
roots = ["tailwind.config.js","tailwind.config.cjs", ".prettierrc.json"]

[[language]]
name = "jsx"
language-servers = ["tailwindcss-react", "tsreact"]
roots = ["tailwind.config.js","tailwind.config.cjs", ".prettierrc.json"]
...

Until helix client doesn't respond to workspace/configuration I will use this.

@MatthiasGrandl
Copy link

@uros-5 I am using your patched LSP and it works! Well kinda, the completions are kinda messed up for me. As soon a I enter the first hyphen in my class, it just displays random other classes. Anybody else got that issue?

@uros-5
Copy link

uros-5 commented May 24, 2023

@uros-5 I am using your patched LSP and it works! Well kinda, the completions are kinda messed up for me. As soon a I enter the first hyphen in my class, it just displays random other classes. Anybody else got that issue?

I had that too on previous version of helix. Try updating to the latest or build from source.

@MatthiasGrandl
Copy link

@uros-5 ah thanks! I am currently using the the copilot MR branch so updating might be a bit tricky, but that certainly explains it.

@jeyj0
Copy link

jeyj0 commented May 24, 2023

I started using your patched LSP too, @uros-5 and as @MatthiasGrandl said it's working for me too. I've found one curious behavior though, which is that if the tailwind LSP is the first in the list, completions (from both TW-LSP and typescript-language-server) work (thanks for the hint about a newer helix build!), but the hover command (from typescript-language-server) doesn't (hitting Space k to get type information from LSP). When typescript-language-server is the first entry instead, both work. I couldn't find anything about whether that's the expected behavior—it certainly feels if the TW-LSP doesn't have any info, helix should fall back on the next LSP in the list?

Edit: I just realized that the TW-LSP should show info when using hover on the class names. That works when it's the first entry. So it seems to me this is just helix not handling the multiple-LSP case for hover at all yet?

@uros-5
Copy link

uros-5 commented May 24, 2023

I've found one curious behavior though, which is that if the tailwind LSP is the first in the list, completions (from both TW-LSP and typescript-language-server) work (thanks for the hint about a newer helix build!), but the hover command (from typescript-language-server) doesn't (hitting Space k to get type information from LSP).

We talked about that in (this) issue and also here.
Helix codebase changed a lot since January so check this. It's up with master + hover works for multiple languages. I don't know other solution for hover.

@H4ckint0sh
Copy link

I've found one curious behavior though, which is that if the tailwind LSP is the first in the list, completions (from both TW-LSP and typescript-language-server) work (thanks for the hint about a newer helix build!), but the hover command (from typescript-language-server) doesn't (hitting Space k to get type information from LSP).

We talked about that in (this) issue and also here. Helix codebase changed a lot since January so check this. It's up with master + hover works for multiple languages. I don't know other solution for hover.

This did not work for me, I am not getting any hover ro tailwinds classes.

@uros-5
Copy link

uros-5 commented May 24, 2023

This did not work for me, I am not getting any hover ro tailwinds classes.

Have you tried to build from source?
I updated helix-twcss package. Reinstall it globally.

@H4ckint0sh
Copy link

H4ckint0sh commented May 24, 2023

This did not work for me, I am not getting any hover ro tailwinds classes.

Have you tried to build from source? I updated helix-twcss package. Reinstall it globally.

I did build your fork from source.

EDIT:
did not work either. still no hover. completion is working dough.

@uros-5
Copy link

uros-5 commented May 24, 2023

EDIT: helix-twcss ? how do I do that?

Please read previous comments.. It's not that hard.

@cmnstmntmn
Copy link
Contributor

@tcoopman did you manage to make it work with elixir?

catdevnull added a commit to catdevnull/helix that referenced this issue Sep 7, 2023
this is not intended to be upstreamed. it's a hack to get jsx/svelte + tailwind to work together

related to helix-editor#2213 (comment)

i realized afterwards that https://github.com/uros-5/helix/tree/just-hover exists which implements something really similar
@catdevnull
Copy link

catdevnull commented Sep 7, 2023

i ended up implementing something similar to @uros-5 (before realizing it had been done before) in https://github.com/catdevnull/helix/tree/multiple-lsp-hover. thanks!

uros' implementation is better for the jsx/svelte + tailwind use case because it just pushes the result of the first server that returns. but mine "tries" (but probably fails, didn't test) to get hovers from all servers to merge them all together in the same hover window, which could be helpful for some weird use case where you want to see multiple hovers from multiple servers.

@tcoopman
Copy link

tcoopman commented Sep 7, 2023

@cmnstmntmn no, not yet. But I can't immediately find out why it doesn't work. I've discussed about it a bit here as well: https://elixirforum.com/t/getting-heex-and-h-working-in-nvim-with-astronvim/54779/30?u=tcoopman

@the-mikedavis
Copy link
Member

@catdevnull
Copy link

uh, did you test this? i can't get it working with @tailwindcss/language-server 0.0.13 but it works with helix-twcss 0.0.15-alpha.1

@gabydd
Copy link
Member

gabydd commented Sep 10, 2023

seems like the other pr to fix tailwind with helix hasn't been released yet: tailwindlabs/tailwindcss-intellisense#803 try the insiders command recommended in this pr

@swlkr
Copy link

swlkr commented Sep 13, 2023

the server is up and running both hx-tw and the latest @insiders version seem to start up, but they return null for everything and I'm starting to think it's because I'm using tailwindcli's "standalone" version not the version from npm

wanted to see if anyone else is using the standalone cli here and has a similar problem with nulls being returned on hover/completion

@tcoopman
Copy link

@swlkr maybe you want to move this into a discussion. I'm happy to help because I have working version for javascript/typescript with tailwind running with npx. I do get null answers when I try to use it with elixir.

@David-Else
Copy link
Contributor

Hi, I just used tailwind for the first time today. There is a lot of chat about broken things being fixed here, and it all seems out of date. Can I use tailwindcss-intellisense language server today in Helix on the latest master? If so, exactly what do I need to add to my config? I just want to see documentation and get auto-completion in my HTML. Thanks :)

@happysalada
Copy link
Contributor

No not yet. The PR for the fixes on tailwind-intellisense has been merged, but no new release has been made.
I asked a couple of weeks ago after the PR was merged for a new release and they answered that the person making the releases was on holiday and would make a new release soon.
So either you build intellisense from master or you wait for a new intellisense release.

@tcoopman
Copy link

you can use the insiders build: npm install @tailwindcss/language-server@insiders

@David-Else
Copy link
Contributor

I have made a pull request to get Tailwind into Helix officially, please could everyone involved in this thread hop over and have a look as you all have more experience than me! :)

#8442

@David-Else
Copy link
Contributor

68fce3e was merged... I suggest updating your configs to avoid cruft and bloat. Keep it clean :)

@david-crespo
Copy link
Contributor

david-crespo commented Oct 26, 2023

In case anyone else lands here wondering why it still doesn't work despite all the above, for me the trick was installing the insiders version of @tailwindcss/language-server instead of the default latest stable release. I see this was mentioned above but I wanted to highlight it and give a little more detail.

npm install -g @tailwindcss/language-server@insiders

Then (because the config for the language server is built in) all you have to do is add it to the list for your file type:

[[language]]
name = "tsx"
language-servers = [ "typescript-language-server", "tailwindcss-ls" ]

Before installing insiders I was getting errors like this

2023-10-26T12:44:18.885 helix_lsp::client [WARN] language server failed to terminate gracefully - server closed the stream
2023-10-26T12:44:18.899 helix_lsp::transport [ERROR] tailwindcss-ls err: <- StreamClosed

@happysalada
Copy link
Contributor

To be sure, the fix was upstreamed on master. They mentioned they were about to do a release this week, but its still pending.
Ive been in touch with upstream and i will add this to nixpkgs after the release for those interested.

@gbogarinb
Copy link
Contributor

gbogarinb commented Oct 29, 2023

I can't make this work with svelteserver, is either one or the other depending on which one is declared first in language-servers.

Edit:

i ended up implementing something similar to @uros-5 (before realizing it had been done before) in https://github.com/catdevnull/helix/tree/multiple-lsp-hover. thanks!

uros' implementation is better for the jsx/svelte + tailwind use case because it just pushes the result of the first server that returns. but mine "tries" (but probably fails, didn't test) to get hovers from all servers to merge them all together in the same hover window, which could be helpful for some weird use case where you want to see multiple hovers from multiple servers.

Applied the changes in this commit manually since master is way ahead and recompiled, now it works fine.

@happysalada
Copy link
Contributor

For anyone still following the latest version of tailwindcss-language-server was just released (with the fix needed to make this work properly, version 0.0.14).
I'm making a package in nixpkgs for those using nixos
NixOS/nixpkgs#264899

@Nintron27
Copy link

Nintron27 commented Nov 2, 2023

For anyone still following the latest version of tailwindcss-language-server was just released (with the fix needed to make this work properly, version 0.0.14). I'm making a package in nixpkgs for those using nixos NixOS/nixpkgs#264899

Can confirm v0.0.14 of @tailwindcss/language-server works (atleast for svelte files)! One issue I am noticing though is that the hyphens in Tailwind's class names is causing the LSP suggestions to break.

Here is my working config:

[[language]]
name = "svelte"
indent = { tab-width = 4, unit = "\t" }
auto-format = true
roots = ["svelte.config.js"]
language-servers = ["tailwindcss-ls", "svelteserver"]

Here are screenshots of that hyphen issue, also for some reason certain html elements don't have syntax highlighting on the opening tag, oh well.
Without hyphens:
image
Then with hyphens:
image

@happysalada
Copy link
Contributor

Could you file an issue upstream ? There is a new developper on the project that is very responsive. If its a simple fix, it will likely be taken care of.

@gabydd
Copy link
Member

gabydd commented Nov 2, 2023

The hyphen stuff is a helix problem that will be fixed with the event system

@sukidhar
Copy link

sukidhar commented Nov 23, 2023

Has anyone got Tailwind working with elixir/phoenix. I seem to get this logs.

2023-11-19T15:36:50.136 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "[assets/tailwind.config.js] Initializing..." }
2023-11-19T15:36:50.136 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4,"message":"[assets/tailwind.config.js] Loaded Tailwind CSS config file: /Users/sukidhar/Documents/Files.nosync/engine/assets/tailwind.config.js"}}
2023-11-19T15:36:50.136 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "[assets/tailwind.config.js] Loaded Tailwind CSS config file: /Users/sukidhar/Documents/Files.nosync/engine/assets/tailwind.config.js" }
2023-11-19T15:36:50.136 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4,"message":"[assets/tailwind.config.js] Loaded postcss v8.4.23: /Users/sukidhar/Documents/Files.nosync/engine/assets/node_modules/postcss"}}
2023-11-19T15:36:50.136 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4,"message":"[assets/tailwind.config.js] Loaded tailwindcss v3.3.1: /Users/sukidhar/Documents/Files.nosync/engine/assets/node_modules/tailwindcss"}}
2023-11-19T15:36:50.136 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "[assets/tailwind.config.js] Loaded postcss v8.4.23: /Users/sukidhar/Documents/Files.nosync/engine/assets/node_modules/postcss" }
2023-11-19T15:36:50.136 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4,"message":"[assets/tailwind.config.js] Building..."}}
2023-11-19T15:36:50.136 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "[assets/tailwind.config.js] Loaded tailwindcss v3.3.1: /Users/sukidhar/Documents/Files.nosync/engine/assets/node_modules/tailwindcss" }
2023-11-19T15:36:50.136 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4}}
2023-11-19T15:36:50.136 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "[assets/tailwind.config.js] Building..." }
2023-11-19T15:36:50.136 helix_term::application [ERROR] received malformed notification from Language Server: protocol error: InvalidParams: Invalid params: missing field `message`.
2023-11-19T15:36:50.136 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4,"message":"\u001b[35m%s\u001b[0m"}}
2023-11-19T15:36:50.137 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "\u{1b}[35m%s\u{1b}[0m" }
2023-11-19T15:36:50.137 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4,"message":"\u001b[32m%s\u001b[0m"}}
2023-11-19T15:36:50.137 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4,"message":"\u001b[32m%s\u001b[0m"}}
2023-11-19T15:36:50.137 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "\u{1b}[32m%s\u{1b}[0m" }
2023-11-19T15:36:50.137 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4}}
2023-11-19T15:36:50.137 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Log, message: "\u{1b}[32m%s\u{1b}[0m" }
2023-11-19T15:36:50.137 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","id":4,"method":"workspace/configuration","params":{"items":[{"section":"editor","scopeUri":"file:///Users/sukidhar/Documents/Files.nosync/engine/lib/engine_web/live/landing_live/index.html.heex"}]}}
2023-11-19T15:36:50.137 helix_term::application [ERROR] received malformed notification from Language Server: protocol error: InvalidParams: Invalid params: missing field `message`.
2023-11-19T15:36:50.137 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","id":5,"method":"workspace/configuration","params":{"items":[{"section":"tailwindCSS","scopeUri":"file:///Users/sukidhar/Documents/Files.nosync/engine/lib/engine_web/live/landing_live/index.html.heex"}]}}
2023-11-19T15:36:50.137 helix_lsp::transport [INFO] tailwindcss-heex <- {"jsonrpc":"2.0","method":"@/tailwindCSS/projectInitialized","params":[null]}
2023-11-19T15:36:50.137 helix_lsp::transport [INFO] tailwindcss-heex -> {"jsonrpc":"2.0","result":[null],"id":4}

Here is my config with Lexical LS. Lexical is working however Tailwind does not.

[language-server.lexical]
command = "/Users/sukidhar/Documents/elixir/lexical/_build/dev/package/lexical/bin/start_lexical.sh"

[language-server.tailwindcss-heex]
language-id = "phoenix-heex"
command = "tailwindcss-language-server"
args = ["--stdio"]

[[language]]
name = "elixir"
language-servers = ["lexical"]

[[language]]
name = "heex"
language-servers = ["lexical", "tailwindcss-heex"]

I have installed tailwind-language-server using npm install -g @tailwindcss/language-server@insiders

@jelkand
Copy link

jelkand commented Nov 29, 2023

@sukidhar Your language-id needs to be under the language definition, not the language-server definition.

Example:

[language-server.lexical]
command = "/Users/jelkand/dev/lexical/_build/dev/package/lexical/bin/start_lexical.sh"

[language-server.tailwind-heex]
command = "tailwindcss-language-server"
args = ["--stdio"]

[[language]]
name = "elixir"
language-servers = ["lexical"]
auto-format = true

[[language]]
name = "heex"
language-id = "phoenix-heex"
language-servers = ["tailwind-heex", "lexical"]
auto-format = true

@tcoopman
Copy link

@jelkand did you ever to manage to get tailwind working with elixir (so inside ~H)?

@jelkand
Copy link

jelkand commented Nov 29, 2023

@jelkand did you ever to manage to get tailwind working with elixir (so inside ~H)?

I haven't tested this extensively, but providing language-id = "phoenix-heex" also provides tailwind autocomplete within the H sigils. Lexical doesn't seem to mind and still provides autocomplete too.

@tcoopman
Copy link

awesome, that works with elixir-ls as well

@sukidhar
Copy link

sukidhar commented Nov 29, 2023

yes, I have tested it works!!! 🚀 that is really helpful

@gitmalong
Copy link

[[language]]
name = "rust"
auto-format = true
language-servers = ["rust-analyzer", "tailwindcss-ls"]
roots = [
  "Cargo.toml",
  "Cargo.lock"
]

[language.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
'"' = '"'
'`' = '`'

[language-server.tailwindcss-ls]
command = "tailwindcss-language-server"
args = ["--stdio"]
config = {userLanguages = { rust = "html", "*.rs" = "html" } }

[language-server.rust-analyzer.config]
inlayHints.bindingModeHints.enable = false
command = "rust-analyzer"
check.command = "clippy"
inlayHints.closingBraceHints.minLines = 10
inlayHints.closureReturnTypeHints.enable = "with_block"
inlayHints.discriminantHints.enable = "fieldless"
inlayHints.lifetimeElisionHints.enable = "skip_trivial"
inlayHints.typeHints.hideClosureInitialization = false
procMacro = { ignored = { leptos_macro = [
    "server", "component"
] } } 

[language.formatter]
command = "rustfmt"

I am trying to get this working with Leptos but it fails with:

2024-06-16T22:23:24.562 helix_term::application [ERROR] Ignoring unknown notification from Language Server: protocol error: InvalidParams: Invalid params: missing field `message`.
2024-06-16T22:23:40.556 helix_lsp::transport [ERROR] tailwindcss-ls err: <- StreamClosed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.