Closed patrolli closed 2 years ago
Thanks for the nice issue report. I think I have everything I need here.
I got the same issue on Windows 10 with Emacs 29.0.50 + eglot latest master branch
When a execute M-x eglot
on a python buffer, I got this error:
[eglot] Connected! Server `EGLOT (python/python-mode)' now managing `python-mode' buffers in project `python'.
[jsonrpc] Server exited with status 1
[eglot] (warning) Not auto-reconnecting, last one didn't last long.
Messages on `EGLOT (python/pyton-mode) events buffer
[client-request] (id:1) Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
(:processId 9244 :rootPath "c:/Users/Aqua/src/python/" :rootUri "file:///c%3A/Users/Aqua/src/python" :initializationOptions #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
())
:capabilities
(:workspace
(:applyEdit t :executeCommand
(:dynamicRegistration :json-false)
:workspaceEdit
(:documentChanges :json-false)
:didChangeWatchedFiles
(:dynamicRegistration t)
:symbol
(:dynamicRegistration :json-false)
:configuration t)
:textDocument
(:synchronization
(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
:completion
(:dynamicRegistration :json-false :completionItem
(:snippetSupport t)
: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))
:experimental #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
()))))
[server-notification] Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:type 3 :message "Pyright language server 1.1.206 starting"))
[server-notification] Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:type 3 :message "Server root directory: c:\\Users\\Aqua\\AppData\\Roaming\\npm\\node_modules\\pyright/dist/"))
[server-reply] (id:1) Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :id 1 :result
(:capabilities
(:textDocumentSync 2 :definitionProvider
(:workDoneProgress t)
:declarationProvider
(:workDoneProgress t)
:typeDefinitionProvider
(:workDoneProgress t)
:referencesProvider
(:workDoneProgress t)
:documentSymbolProvider
(:workDoneProgress t)
:workspaceSymbolProvider
(:workDoneProgress t)
:hoverProvider
(:workDoneProgress t)
:documentHighlightProvider
(:workDoneProgress t)
:renameProvider
(:workDoneProgress t)
:completionProvider
(:triggerCharacters
["." "["]
:resolveProvider t :workDoneProgress t)
:signatureHelpProvider
(:triggerCharacters
["(" "," ")"]
:workDoneProgress t)
:codeActionProvider
(:codeActionKinds
["quickfix" "source.organizeImports"]
:workDoneProgress t)
:executeCommandProvider
(:commands
[]
:workDoneProgress t)
:callHierarchyProvider t)))
[client-notification] Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
()))
[client-notification] Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
(:textDocument
(:uri "file:///c%3A/Users/Aqua/src/python/test.py" :version 0 :languageId "python" :text "print(\"Hello\")\n")))
[client-notification] Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
(:settings nil))
[server-request] (id:0) Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :id 0 :method "client/registerCapability" :params
(:registrations
[(:id "385b5b00-f1fa-454e-8687-08cb28411009" :method "workspace/didChangeWatchedFiles" :registerOptions
(:watchers
[(:globPattern "**/pyrightconfig.json" :kind 7)
(:globPattern "**" :kind 7)]))]))
[client-reply] (id:0) ERROR Mon Jan 10 10:50:51 2022:
(:jsonrpc "2.0" :id 0 :error
(:code -32603 :message "Internal error"))
[server-request] (id:1) Mon Jan 10 10:50:51 2022:
(:jsonrpc "2.0" :id 1 :method "workspace/configuration" :params
(:items
[(:scopeUri "" :section "python")]))
[client-reply] (id:1) Mon Jan 10 10:50:51 2022:
(:jsonrpc "2.0" :id 1 :result
[nil])
[stderr] Error: Internal error
[stderr] at handleResponse (c:\Users\Aqua\AppData\Roaming\npm\node_modules\pyright\dist\pyright-internal\node_modules\vscode-jsonrpc\lib\common\connection.js:477:48)
[stderr] at processMessageQueue (c:\Users\Aqua\AppData\Roaming\npm\node_modules\pyright\dist\pyright-internal\node_modules\vscode-jsonrpc\lib\common\connection.js:292:17)
[stderr] at Immediate.<anonymous> (c:\Users\Aqua\AppData\Roaming\npm\node_modules\pyright\dist\pyright-internal\node_modules\vscode-jsonrpc\lib\common\connection.js:276:13)
[stderr] at processImmediate (node:internal/timers:473:21)
[internal] Mon Jan 10 10:50:51 2022:
(:message "Connection state changed" :change "exited abnormally with code 1\n")
----------b---y---e---b---y---e----------
[stderr]
[stderr]
[stderr] nil
[stderr] nil
[stderr] Process EGLOT (python/python-mode) stderr finished
When I enable (setq debug-on-error t)
I will got this Backtrace error:
Debugger entered--Lisp error: (error "File listing failed: FIND: Parameter format not co...")
signal(error ("File listing failed: FIND: Parameter format not co..."))
error("File listing failed: %s" "FIND: Parameter format not correct\n")
project--files-in-directory("c:/Users/Aqua/src/python/" ("SCCS/" "RCS/" "CVS/" "MCVS/" ".src/" ".svn/" ".git/" ".hg/" ".bzr/" "_MTN/" "_darcs/" "{arch}/" ".#*" "*.hi" "*.o" "*~" "*.bin" "*.bak" "*.obj" "*.map" "*.ico" "*.pif" "*.lnk" "*.a" "*.ln" "*.blg" "*.bbl" "*.dll" "*.drv" "*.vxd" "*.386" "*.elc" "*.lof" "*.glo" "*.idx" "*.lot" "*.fmt" "*.tfm" "*.class" "*.fas" "*.lib" "*.mem" "*.x86f" "*.sparcf" "*.dfsl" "*.pfsl" "*.d64fsl" "*.p64fsl" "*.lx64fsl" "*.lx32fsl" ...))
#f(compiled-function (dir) #<bytecode 0x195f641321420033>)("c:/Users/Aqua/src/python/")
mapcan(#f(compiled-function (dir) #<bytecode 0x195f641321420033>) ("c:/Users/Aqua/src/python/"))
#f(compiled-function (project &optional dirs) #<bytecode 0x13dbd18643dd44f7>)((transient . "c:/Users/Aqua/src/python/"))
apply(#f(compiled-function (project &optional dirs) #<bytecode 0x13dbd18643dd44f7>) (transient . "c:/Users/Aqua/src/python/") nil)
project-files((transient . "c:/Users/Aqua/src/python/"))
#f(compiled-function (arg1 arg2 arg3 &rest rest) "Handle dynamic registration of workspace/didChangeWatchedFiles." #<bytecode 0x1089a22d698947b9>)(#<eglot-lsp-server eglot-lsp-server-5820802c20> workspace/didChangeWatchedFiles "dced6339-0f60-4507-b58e-63ad6e36765c" :watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)])
apply(#f(compiled-function (arg1 arg2 arg3 &rest rest) "Handle dynamic registration of workspace/didChangeWatchedFiles." #<bytecode 0x1089a22d698947b9>) #<eglot-lsp-server eglot-lsp-server-5820802c20> workspace/didChangeWatchedFiles ("dced6339-0f60-4507-b58e-63ad6e36765c" :watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))
eglot-register-capability(#<eglot-lsp-server eglot-lsp-server-5820802c20> workspace/didChangeWatchedFiles "dced6339-0f60-4507-b58e-63ad6e36765c" :watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)])
apply(eglot-register-capability #<eglot-lsp-server eglot-lsp-server-5820802c20> workspace/didChangeWatchedFiles "dced6339-0f60-4507-b58e-63ad6e36765c" (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))
eglot--register-unregister(#<eglot-lsp-server eglot-lsp-server-5820802c20> [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))] register)
#f(compiled-function (arg1 arg2 &rest rest) "Handle server request client/registerCapability." #<bytecode -0x1ae64f9ee7065ca4>)(#<eglot-lsp-server eglot-lsp-server-5820802c20> client/registerCapability :registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))])
apply(#f(compiled-function (arg1 arg2 &rest rest) "Handle server request client/registerCapability." #<bytecode -0x1ae64f9ee7065ca4>) #<eglot-lsp-server eglot-lsp-server-5820802c20> client/registerCapability (:registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))]))
eglot-handle-request(#<eglot-lsp-server eglot-lsp-server-5820802c20> client/registerCapability :registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))])
apply(eglot-handle-request #<eglot-lsp-server eglot-lsp-server-5820802c20> client/registerCapability (:registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))]))
#f(compiled-function (server method params) #<bytecode -0x377de23c75886c>)(#<eglot-lsp-server eglot-lsp-server-5820802c20> client/registerCapability (:registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))]))
jsonrpc-connection-receive(#<eglot-lsp-server eglot-lsp-server-5820802c20> (:jsonrpc "2.0" :id 0 :method "client/registerCapability" :params (:registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))])))
jsonrpc--process-filter(#<process EGLOT (python/python-mode)> "Content-Length: 291\15\n\15\n{\"jsonrpc\":\"2.0\",\"id\":0,\"me...")
my eglot config:
(use-package eglot
:defer t
:bind (:map eglot-mode-map
("C-c l a" . eglot-code-actions)
("C-c l r" . eglot-rename)
("C-c l f" . eglot-format)
("C-c l d" . eldoc))
:hook (eglot-managed-mode . (lambda () (flymake-mode -1)))
:config
(add-to-list 'eglot-server-programs '(rust-mode "rust-analyzer"))
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd"))
(setq read-process-output-max (* 1024 1024))
(push :documentHighlightProvider eglot-ignored-server-capabilities)
(setq eldoc-echo-area-use-multiline-p nil))
β ~ pyright --version
pyright 1.1.206
The same config works well on Mac and Arch Linux
Thanks, again this contains an actual error with a backtrace so it shouldn't be very hard to pinpoint. However I've not had time to look at this. Seems to be triggered by project-files
failing to do its work on windows by not finding the proper external program. So might not be a problem specifically in Eglot. @skangas maybe we could analyze this before or after the release.
In fact, I install the latest eglot from melpa, and enable it with pyright server in a simple python project. This problem I report seems disappear but a new error raised. It shows in my echo area frequently that "error in process filter: [eglot] A `Diagnostic' mustn't have (:codeDescription)". :(
In fact, I install the latest eglot from melpa, and enable it with pyright server in a simple python project. This problem I report seems disappear but a new error raised. It shows in my echo area frequently that "error in process filter: [eglot] A `Diagnostic' mustn't have (:codeDescription)". :(
Could you report that as a new issue with the full details? Thanks!
@joaotavora Thanks for your advice. Now, I figure out what cause this issue on Windows system.
It is because there is a C:\Windows\System32\find.exe
in my PATH. so the project
package use the wrong find
program.
Fixed it by : Download the right findutils and put it in the system path, and now eglot works well on Windows.
β ~ which find
D:\winport\findutils-4.2.30-5-w64-bin\bin\find.exe
LSP transcript - M-x eglot-events-buffer (mandatory unless Emacs inoperable)
Backtrace (mandatory, unless no error message seen or heard):
Minimal configuration (mandatory)
When M-x
eglot
for a python file buffer, these is a message in the message area:[eglot] (warning) Not auto-reconnecting, last one didn't last long.
Additional information: python --version: 3.9.9 pyright --version: 1.1.193