Skip to content

neovim reacts badly to goto definitions on a namedtuple property #696

@kaddkaka

Description

@kaddkaka

When 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions