joaotavora / eglot

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

Eglot + pyright not starting #1186

Closed aadi58002 closed 1 year ago

aadi58002 commented 1 year ago
[internal] Tue Mar 21 15:29:29 2023:
(:message "Running language server: pyright-langserver --stdio")
[client-request] (id:1) Tue Mar 21 15:29:29 2023:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
          (:processId 1436 :rootPath "/home/aditya-yadav/Personal/Projects/Python/Cp/" :rootUri "file:///home/aditya-yadav/Personal/Projects/Python/Cp" :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 :json-false :deprecatedSupport t :resolveSupport
                                                               (:properties
                                                                ["documentation" "details" "additionalTextEdits"])
                                                               :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)
                        :inlayHint
                        (:dynamicRegistration :json-false)
                        :publishDiagnostics
                        (:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
                                             (:valueSet
                                              [1 2])))
                       :general
                       (:positionEncodings
                        ["utf-32" "utf-8" "utf-16"])
                       :experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                   ()))
                      :workspaceFolders
                      [(:uri "file:///home/aditya-yadav/Personal/Projects/Python/Cp" :name "~/Personal/Projects/Python/Cp/")]))
[internal] Tue Mar 21 15:29:59 2023:
(:message "Connection state changed" :change "killed\n")

----------b---y---e---b---y---e----------
[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process EGLOT (Cp/(python-mode python-ts-mode)) stderr finished

stderr buffer

eglot--current-server-or-lose: jsonrpc-error: "No current JSON-RPC connection", (jsonrpc-error-code . 32603), (jsonrpc-error-message . "No current JSON-RPC connection")
[jsonrpc] Server exited with status 9
Error running timer: (error "[eglot] Timed out after 30 seconds")

Minimal config

(use-package eldoc-box
  :config
  (setq eldoc-echo-area-use-multiline-p nil))

(use-package flycheck
  :config
  (global-flycheck-mode 1))
(use-package flycheck-eglot
  :after (flycheck eglot)
  :config
  (global-flycheck-eglot-mode 1))
(use-package eglot
  :after (eldoc-box)
  :hook ((prog-mode . eglot-ensure))
  :config
  (setq completion-category-overrides '((eglot (styles orderless))))
  (setq eldoc-idle-delay 0.0
        ;; eglot-events-buffer-size 0
        flymake-no-changes-timeout 0.5
        eglot-autoshutdown t)
  (add-hook 'eglot-managed-mode-hook #'eldoc-box-hover-mode t)
  (add-hook 'eglot-managed-mode-hook
            (lambda ()
              "Make sure Eldoc will show us all of the feedback at point."
              (setq-local eldoc-documentation-strategy
                          #'eldoc-documentation-compose)))
  (add-to-list 'eglot-ignored-server-capabilities :hoverProvider)
  (add-to-list 'eglot-server-programs '((python-mode python-ts-mode) . ("pyright-langserver" "--stdio")))
  (add-to-list 'eglot-server-programs '(svelte-mode . ("svelteserver" "--stdio")))
  (add-to-list 'eglot-server-programs `((c-mode c-ts-mode c++-mode c++-ts-mode)
                                        . ,(eglot-alternatives
                                            '("ccls" "clangd")))))
joaotavora commented 1 year ago

@aadi58002 I'm very sorry, but this is not the same error as you reported in https://github.com/joaotavora/eglot/issues/1094, For example, there's no error backtrace now. Did you M-x toggle-debug-on-error?

Maybe read https://joaotavora.github.io/eglot/#Troubleshooting-Eglot again.

Also this config is not "minimal" at at all. What is flycheck, and orderless doing here? Where is the minimal project so that I can reproduce this? Did you re-run your recipe?

All these elements are missing. It's OK not to have them. Sometimes it takes some work to collect them.

Reporting a bug formally is not a matter of just finding some Eglot related things in your config to dump into the "put configuration here" box. I simply don't have time to go on a wild goose chase trying to guess what your problem is.

So I'm going to move this to a discussion. There you can post more information.