Skip to content

Conversation

@ixti
Copy link

@ixti ixti commented Dec 5, 2025

As of NeoVim 0.11 get_node hard enforces row and col to be non-negative (via assert), that causes endwise fail in those cases:

Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/treesitter.lua:384: Invalid position: row and col must be non-negative                                                                                
stack traceback:                                                                                                                                                                                                                 
        [C]: in function 'assert'                                                                                                                                                                                                
        /usr/share/nvim/runtime/lua/vim/treesitter.lua:384: in function 'get_node'                                                                                                                                               
        .../nvim-treesitter-endwise/lua/nvim-treesitter/endwise.lua:124: in function 'endwise'                                                                                                                                   
        .../nvim-treesitter-endwise/lua/nvim-treesitter/endwise.lua:216: in function ''                                                                                                                                          
        vim/_editor.lua: in function <vim/_editor.lua:0>  

This patch makes it compatible with previous and current version of NeoVim by exiting early when it's clear that get_node will return nil (on NeoVim 0.10) or fail (on NeoVim 0.11).

As of NeoVim 0.11 `get_node` hard enforces row and col to be
non-negative (via assert), that causes endwise fail in those
cases.

```
Error executing vim.schedule lua callback:
    /usr/share/nvim/runtime/lua/vim/treesitter.lua:384:
    Invalid position: row and col must be non-negative
stack traceback:
    [C]: in function 'assert'
    /usr/share/nvim/runtime/lua/vim/treesitter.lua:384:
        in function 'get_node'
    .../nvim-treesitter-endwise/lua/nvim-treesitter/endwise.lua:124:
        in function 'endwise'
    .../nvim-treesitter-endwise/lua/nvim-treesitter/endwise.lua:216:
        in function ''
    vim/_editor.lua:
        in function <vim/_editor.lua:0>
```

This patch makes it compatible with previous and current version of
NeoVim by exiting early when it's clear that get_node will return nil
(on NeoVim 0.10) or fail (on NeoVim 0.11).
@ixti ixti force-pushed the nvim-0-11-compat branch from 4784147 to 68313c4 Compare December 5, 2025 17:57
ixti added a commit to ixti/dotfiles that referenced this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant