GeezerVison is showing github.com — neovim reacts badly to goto definitions on a namedtuple property · Issue #696 · python-lsp/python-lsp-server
neovim reacts badly to goto definitions on a namedtuple property #696DescriptionWhen my cursor is position marked below, calling vim.lsp.buf.definition() in Neovim will result in an error reply.
from collections import namedtuple
Access = namedtuple("Access", ["address", "type"])
a = Access(100, "w")
a.address
# ^------ With the cursor here
Results in this Neovim error:
Error executing vim.schedule lua callback: ...nt_nvimhJLLgB/usr/share/nvim/runtime/lua/vim/lsp/buf.lua:226: Cursor position outside buffer
stack traceback:
[C]: in function 'nvim_win_set_cursor'
...nt_nvimhJLLgB/usr/share/nvim/runtime/lua/vim/lsp/buf.lua:226: in function 'on_response'
...nt_nvimhJLLgB/usr/share/nvim/runtime/lua/vim/lsp/buf.lua:245: in function 'handler'
...nvimhJLLgB/usr/share/nvim/runtime/lua/vim/lsp/client.lua:682: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue
And after pressing opening a new buffer called /None with no content. (None is the null value in python)
Is this an issue in solely in Neovim or some bad interaction between Neovim and pylsp?
Environment:
- python-lsp-server (pylsp)
1.14.0
- python
3.13.7
- nvim
0.11.5
I also posted similar comment with more Neovim details at neovim/neovim#30908 Activitykaddkaka commented on Feb 6, 2026 On a similar setup but with different python version I got this traceback from inside pylsp:
"""
WARNING - pylsp.config.config - Failed to load hook pylsp_definitions: unsupported operand type(s) for -: 'NoneType' and 'int'
Traceback (most recent call last):
File \"/home/david/.local/share/pipx/venvs/python-lsp-server/lib/python3.12/site-packages/pylsp/config/config.py\", line 40, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File \"/nix/store/2zjymfkfbrxqz7cxj9pvrd3ci0s8rjgr-python3.10-pluggy-1.5.0/lib/python3.10/site-packages/pluggy/_manager.py\", line 480, in traced_hookexec
return outcome.get_result()
^^^^^^^^^^^^^^^^^^^^
File \"/nix/store/2zjymfkfbrxqz7cxj9pvrd3ci0s8rjgr-python3.10-pluggy-1.5.0/lib/python3.10/site-packages/pluggy/_result.py\", line 100, in get_result
raise exc.with_traceback(exc.__traceback__)
File \"/nix/store/2zjymfkfbrxqz7cxj9pvrd3ci0s8rjgr-python3.10-pluggy-1.5.0/lib/python3.10/site-packages/pluggy/_result.py\", line 62, in from_call
result = func()
^^^^^^
File \"/nix/store/2zjymfkfbrxqz7cxj9pvrd3ci0s8rjgr-python3.10-pluggy-1.5.0/lib/python3.10/site-packages/pluggy/_manager.py\", line 477, in <lambda>
lambda: oldcall(hook_name, hook_impls, caller_kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File \"/nix/store/2zjymfkfbrxqz7cxj9pvrd3ci0s8rjgr-python3.10-pluggy-1.5.0/lib/python3.10/site-packages/pluggy/_callers.py\", line 139, in _multicall raise exception.with_traceback(exception.__traceback__)
File \"/nix/store/2zjymfkfbrxqz7cxj9pvrd3ci0s8rjgr-python3.10-pluggy-1.5.0/lib/python3.10/site-packages/pluggy/_callers.py\", line 103, in _multicall res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File \"/home/david/.local/share/pipx/venvs/python-lsp-server/lib/python3.12/site-packages/pylsp/plugins/definition.py\", line 69, in pylsp_definitions
\"start\": {\"line\": d.line - 1, \"character\": d.column},
~~~~~~~^~~
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
"""
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|