You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Eglot works fine in a single Python block in polymode, however creating a second Python block results in an error.
If eglot reconnect is invoked after the creation of the second block (with the cursor in the block), then it starts to work as expected again until another block is created.
Not sure if related to #1085, however my setup is different so think it's good to separate the discussion for now.
Setup used:
Server used: pylsp (issue also observed for pyright)
Emacs version: 29.0.9
Operating system: MacOS
Please let me know if I need to provide additional details to investigate.
Reports
eglot-events-buffer
[internal] Sun Jun 4 15:59:36 2023:
(:message "Running language server: /Users/duynguyen/.local/bin/pylsp")
[client-request] (id:1) Sun Jun 4 15:59:36 2023:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
(:processId 17951 :rootPath "/Users/duynguyen/repos/myfunc/" :rootUri "file:///Users/duynguyen/repos/myfunc" :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 :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:///Users/duynguyen/repos/myfunc" :name "~/repos/myfunc/")]))
[server-reply] (id:1) Sun Jun 4 15:59:37 2023:
(:jsonrpc "2.0" :id 1 :result
(:capabilities
(:codeActionProvider t :codeLensProvider
(:resolveProvider :json-false)
:completionProvider
(:resolveProvider t :triggerCharacters
["."])
:documentFormattingProvider t :documentHighlightProvider t :documentRangeFormattingProvider t :documentSymbolProvider t :definitionProvider t :executeCommandProvider
(:commands
["pylsp_rope.quickfix.generate" "pylsp_rope.refactor.introduce_parameter" "pylsp_rope.refactor.extract.method" "pylsp_rope.refactor.extract.variable" "pylsp_rope.refactor.inline" "pylsp_rope.refactor.local_to_field" "pylsp_rope.refactor.method_to_method_object" "pylsp_rope.refactor.use_function" "pylsp_rope.source.organize_import"])
:hoverProvider t :referencesProvider t :renameProvider t :foldingRangeProvider t :signatureHelpProvider
(:triggerCharacters
["(" "," "="])
:textDocumentSync
(:change 2 :save
(:includeText t)
:openClose t)
:workspace
(:workspaceFolders
(:supported t :changeNotifications t))
:experimental nil)
:serverInfo
(:name "pylsp" :version "1.7.2")))
[client-notification] Sun Jun 4 15:59:37 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] Sun Jun 4 15:59:37 2023:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
(:textDocument
(:uri "file:///Users/duynguyen/repos/myfunc/mre.md" :version 0 :languageId "python" :text "```{python}\nprint(\"Hello!\")\n```")))
[client-notification] Sun Jun 4 15:59:37 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] Sun Jun 4 15:59:38 2023:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
(:uri "file:///Users/duynguyen/repos/myfunc/mre.md" :diagnostics
[(:range
(:start
(:line 0 :character 1)
:end
(:line 0 :character 2))
:message "SyntaxError: Got unexpected token `" :severity 1 :code "E999" :source "ruff" :tags
[])
(:source "mypy" :range
(:start
(:line 0 :character 0)
:end
(:line 0 :character 1000))
:message "mypy: can't read file '/Users/duynguyen/repos/myfunc/mre.md': No such file or directory\n" :severity 1)]))
[client-notification] Sun Jun 4 15:59:45 2023:
(:jsonrpc "2.0" :method "textDocument/didChange" :params
(:textDocument
(:uri "file:///Users/duynguyen/repos/myfunc/mre.md" :version 4)
:contentChanges
[(:range
(:start
(:line 5 :character 1)
:end
(:line 5 :character 1))
:rangeLength 0 :text "r")
(:range
(:start
(:line 5 :character 2)
:end
(:line 5 :character 2))
:rangeLength 0 :text "i")
(:range
(:start
(:line 5 :character 3)
:end
(:line 5 :character 3))
:rangeLength 0 :text "n")
(:range
(:start
(:line 5 :character 4)
:end
(:line 5 :character 4))
:rangeLength 0 :text "t")]))
[client-request] (id:2) Sun Jun 4 15:59:45 2023:
(:jsonrpc "2.0" :id 2 :method "textDocument/signatureHelp" :params
(:textDocument
(:uri "file:///Users/duynguyen/repos/myfunc/mre.md")
:position
(:line 5 :character 5)))
[client-request] (id:3) Sun Jun 4 15:59:45 2023:
(:jsonrpc "2.0" :id 3 :method "textDocument/hover" :params
(:textDocument
(:uri "file:///Users/duynguyen/repos/myfunc/mre.md")
:position
(:line 5 :character 5)))
[client-request] (id:4) Sun Jun 4 15:59:45 2023:
(:jsonrpc "2.0" :id 4 :method "textDocument/documentHighlight" :params
(:textDocument
(:uri "file:///Users/duynguyen/repos/myfunc/mre.md")
:position
(:line 5 :character 5)))
[stderr] 2023-06-04 15:59:46,031 CEST - WARNING - pylsp.config.config - Failed to load hook pylsp_signature_help: `line` parameter is not in a valid range.
[stderr] Traceback (most recent call last):
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pylsp/config/config.py", line 33, in _hookexec
[stderr] return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
[stderr] return outcome.get_result()
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
[stderr] raise ex[1].with_traceback(ex[2])
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
[stderr] result = func()
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
[stderr] lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
[stderr] return outcome.get_result()
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
[stderr] raise ex[1].with_traceback(ex[2])
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
[stderr] res = hook_impl.function(*args)
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pylsp/plugins/signature.py", line 20, in pylsp_signature_help
[stderr] signatures = document.jedi_script().get_signatures(**code_position)
[stderr] File "/Users/duynguyen/.pyenv/versions/3.10.5/lib/python3.10/site-packages/jedi/api/helpers.py", line 473, in wrapper
[stderr] raise ValueError('`line` parameter is not in a valid range.')
[stderr] ValueError: `line` parameter is not in a valid range.
[server-reply] (id:2) Sun Jun 4 15:59:46 2023:
(:jsonrpc "2.0" :id 2 :result
[])
[stderr] 2023-06-04 15:59:46,033 CEST - WARNING - pylsp.config.config - Failed to load hook pylsp_hover: `line` parameter is not in a valid range.
[stderr] Traceback (most recent call last):
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pylsp/config/config.py", line 33, in _hookexec
[stderr] return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
[stderr] return outcome.get_result()
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
[stderr] raise ex[1].with_traceback(ex[2])
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
[stderr] result = func()
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
[stderr] lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
[stderr] return outcome.get_result()
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
[stderr] raise ex[1].with_traceback(ex[2])
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
[stderr] res = hook_impl.function(*args)
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pylsp/plugins/hover.py", line 14, in pylsp_hover
[stderr] definitions = document.jedi_script(use_document_path=True).infer(**code_position)
[stderr] File "/Users/duynguyen/.pyenv/versions/3.10.5/lib/python3.10/site-packages/jedi/api/helpers.py", line 473, in wrapper
[stderr] raise ValueError('`line` parameter is not in a valid range.')
[stderr] ValueError: `line` parameter is not in a valid range.
[stderr] 2023-06-04 15:59:46,034 CEST - WARNING - pylsp.config.config - Failed to load hook pylsp_document_highlight: `line` parameter is not in a valid range.
[stderr] Traceback (most recent call last):
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pylsp/config/config.py", line 33, in _hookexec
[stderr] return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
[stderr] return outcome.get_result()
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
[stderr] raise ex[1].with_traceback(ex[2])
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
[stderr] result = func()
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
[stderr] lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
[stderr] return outcome.get_result()
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
[stderr] raise ex[1].with_traceback(ex[2])
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
[stderr] res = hook_impl.function(*args)
[stderr] File "/Users/duynguyen/.local/lib/python3.10/site-packages/pylsp/plugins/highlight.py", line 13, in pylsp_document_highlight
[stderr] usages = document.jedi_script().get_references(**code_position)
[stderr] File "/Users/duynguyen/.pyenv/versions/3.10.5/lib/python3.10/site-packages/jedi/api/helpers.py", line 473, in wrapper
[stderr] raise ValueError('`line` parameter is not in a valid range.')
[stderr] ValueError: `line` parameter is not in a valid range.
[internal] (id:3) Sun Jun 4 15:59:55 2023:
(:timed-out :textDocument/hover :id 3 :params
(:textDocument
(:uri "file:///Users/duynguyen/repos/myfunc/mre.md")
:position
(:line 5 :character 5)))
[internal] (id:4) Sun Jun 4 15:59:55 2023:
(:timed-out :textDocument/documentHighlight :id 4 :params
(:textDocument
(:uri "file:///Users/duynguyen/repos/myfunc/mre.md")
:position
(:line 5 :character 5)))
Create a new markdown file (e.g. mre.md) with the following content:
```{python}print("Hello!")```
With cursor in the above python block, do M-x eglot. The LSP server should start correctly.
Under the python block above, try to add another block, e.g.
```{python}print("World!")```
Get the following error: error in process filter: Wrong type argument: plistp
The text was updated successfully, but these errors were encountered:
fast-90
changed the title
Error when creating second Python code block in polymode (using pylsp server)
Error when creating second Python code block in polymode
Jun 4, 2023
I'm not sure whether this is something that needs be fixed in Eglot (or Polymode) or whether it is just something users have to put in their config, however since my issue is solved for now I'm happy to close this one. Feel free to open again if you think it needs addressing in Eglot.
Summary
Eglot works fine in a single Python block in polymode, however creating a second Python block results in an error.
If
eglot reconnect
is invoked after the creation of the second block (with the cursor in the block), then it starts to work as expected again until another block is created.Not sure if related to #1085, however my setup is different so think it's good to separate the discussion for now.
Setup used:
Please let me know if I need to provide additional details to investigate.
Reports
eglot-events-buffer
Backtrace
MRE recipe (tested with
emacs -Q
)pylsp
LSP is installed viapip install
and available in path.eglot
,python
andpoly-markdown
(available on MELPA).Example config
mre.md
) with the following content:python
block, doM-x eglot
. The LSP server should start correctly.python
block above, try to add another block, e.g.error in process filter: Wrong type argument: plistp
The text was updated successfully, but these errors were encountered: