joaotavora / eglot

A client for Language Server Protocol servers
GNU General Public License v3.0
2.21k stars 203 forks source link

tailwindcss-language-server not connecting #1216

Closed torusJKL closed 1 year ago

torusJKL commented 1 year ago

I'm trying to connect eglot to the tailwindcss language server but get the error [eglot] (warning) Not auto-reconnecting, last one didn't last long

Server used: tailwindcss-language-serverr
Emacs version: 28.1
Operating system: GNU/Linux
Eglot version: 1.9
Eglot installation method: use-package
Using Doom: No

(add-to-list 'eglot-server-programs '(html-mode . ("tailwindcss-language-server" "--stdio")))

LSP transcript - M-x eglot-events-buffer

[internal] Wed May  3 20:09:08 2023:
(:message "Running language server: (tailwindcss-language-server --stdio)")
[client-request] (id:1) Wed May  3 20:09:08 2023:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
          (:processId 3576999 :rootPath "/home/gal/code/test-tailwindcss/" :rootUri "file:///home/gal/code/test-tailwindcss" :initializationOptions #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                                                                                                            ())
                      :capabilities
                      (:workspace
                       (:applyEdit t :executeCommand
                                   (:dynamicRegistration :json-false)
                                   :workspaceEdit
                                   (:documentChanges t)
                                   :didChangeWatchedFiles
                                   (:dynamicRegistration t)
                                   :symbol
                                   (:dynamicRegistration :json-false)
                                   :configuration t :workspaceFolders t)
                       :textDocument
                       (:synchronization
                        (:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
                        :completion
                        (:dynamicRegistration :json-false :completionItem
                                              (:snippetSupport t :deprecatedSupport t :tagSupport
                                                               (:valueSet
                                                                [1]))
                                              :contextSupport t)
                        :hover
                        (:dynamicRegistration :json-false :contentFormat
                                              ["markdown" "plaintext"])
                        :signatureHelp
                        (:dynamicRegistration :json-false :signatureInformation
                                              (:parameterInformation
                                               (:labelOffsetSupport t)
                                               :activeParameterSupport t))
                        :references
                        (:dynamicRegistration :json-false)
                        :definition
                        (:dynamicRegistration :json-false :linkSupport t)
                        :declaration
                        (:dynamicRegistration :json-false :linkSupport t)
                        :implementation
                        (:dynamicRegistration :json-false :linkSupport t)
                        :typeDefinition
                        (:dynamicRegistration :json-false :linkSupport t)
                        :documentSymbol
                        (:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind
                                              (:valueSet
                                               [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))
                        :documentHighlight
                        (:dynamicRegistration :json-false)
                        :codeAction
                        (:dynamicRegistration :json-false :codeActionLiteralSupport
                                              (:codeActionKind
                                               (:valueSet
                                                ["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"]))
                                              :isPreferredSupport t)
                        :formatting
                        (:dynamicRegistration :json-false)
                        :rangeFormatting
                        (:dynamicRegistration :json-false)
                        :rename
                        (:dynamicRegistration :json-false)
                        :publishDiagnostics
                        (:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
                                             (:valueSet
                                              [1 2])))
                       :experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                   ()))
                      :workspaceFolders
                      [(:uri "file:///home/gal/code/test-tailwindcss" :name "~/code/test-tailwindcss/")]))
[server-reply] (id:1) Wed May  3 20:09:09 2023:
(:jsonrpc "2.0" :id 1 :result
          (:capabilities
           (:textDocumentSync 1)))
[client-notification] Wed May  3 20:09:09 2023:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                            ()))
[client-notification] Wed May  3 20:09:09 2023:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
          (:textDocument
           (:uri "file:///home/gal/code/test-tailwindcss/index.html" :version 0 :languageId "mhtml" :text "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <link rel=\"shortcut icon\" href=\"/favicon.ico\" />\n    <meta\n      name=\"viewport\"\n      content=\"width=device-width, initial-scale=1, shrink-to-fit=no\"\n    />\n    <meta name=\"theme-color\" content=\"#000000\" />\n    <!--\n      manifest.json provides metadata used when your web app is installed on a\n      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/\n    -->\n    <link rel=\"manifest\" href=\"/manifest.json\" />\n    <title>test-tailwindcss</title>\n  </head>\n  <body>\n    <noscript>You need to enable JavaScript to run this app.</noscript>\n    <div id=\"root\"></div>\n    <!-- Like below. This is the script tag for bootstrapping your Vite application -->\n    <script type=\"module\" src=\"/src/index.tsx\"></script>\n    <!--\n      This HTML file is a template.\n      If you open it directly in the browser, you will see an empty page.\n      You can add webfonts, meta tags, or analytics to this file.\n      The build step will place the bundled scripts into the <body> tag.\n      To begin the development, run `npm start` or `yarn start`.\n      To create a production bundle, use `npm run build` or `yarn build`.\n    -->\n  </body>\n</html>\n")))
[client-notification] Wed May  3 20:09:09 2023:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
          (:settings #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                   ())))
[server-notification] Wed May  3 20:09:09 2023:
(:jsonrpc "2.0" :method "tailwindcss/foundConfig" :params
          [nil])
[server-request] (id:0) Wed May  3 20:09:09 2023:
(:jsonrpc "2.0" :id 0 :method "client/registerCapability" :params
          (:registrations
           [(:id "4cf59501-c266-46b9-8123-a28fef1cb4a0" :method "workspace/didChangeConfiguration" :registerOptions nil)]))
[client-reply] (id:0) Wed May  3 20:09:09 2023:
(:jsonrpc "2.0" :id 0 :result nil)
[server-request] (id:1) Wed May  3 20:09:09 2023:
(:jsonrpc "2.0" :id 1 :method "workspace/configuration" :params
          (:items
           [(:section "tailwindCSS")]))
[client-reply] (id:1) Wed May  3 20:09:09 2023:
(:jsonrpc "2.0" :id 1 :result
          [nil])
[server-request] (id:2) Wed May  3 20:09:09 2023:
(:jsonrpc "2.0" :id 2 :method "workspace/configuration" :params
          (:items
           [(:section "tailwindCSS")]))
[client-reply] (id:2) Wed May  3 20:09:09 2023:
(:jsonrpc "2.0" :id 2 :result
          [nil])
[stderr] /usr/local/lib/node_modules/tailwindcss-language-server/dist/index.js:2
[stderr] /usr/local/lib/node_modules/tailwindcss-language-server/dist/index.js:2
[internal] Wed May  3 20:09:09 2023:
(:message "Connection state changed" :change "exited abnormally with code 1\n")

<removed JS dump>

[stderr] nil
[stderr] nil
[stderr] Process EGLOT (test-tailwindcss/(mhtml-mode js-mode js-ts-mode tsx-ts-mode typescript-ts-mode typescript-mode)) stderr finished
joaotavora commented 1 year ago

Seems like the server is dying unexpectedly. Why? We don't know. The "JS dump" may hold clues. For more analysis, do a bug report according to the instructions in https://joaotavora.github.io/eglot/#Troubleshooting-Eglot. Converting this to a discussion.