Column value outside range with @function.outer + include_surrounding_whitespace
jhillyerd opened this issue · comments
Describe the bug
vaf, yaf, daf trigger column out of range error in go file with include_surrounding_whitespace enabled. Setting it to false prevents the error.
To Reproduce
Steps to reproduce the behavior:
- Have working Go treesitter config
- Run:
mkdir tmp
cd tmp
git clone https://github.com/jhillyerd/enmime
cd enmime/
git checkout 95601a3
nvim part_test.go
- In nvim:
12j
to enter TestPlainTextPart func vaf
will trigger the error (pasted into add'l context below)
Expected behavior
Selection to succeed without error
Output of :checkhealth nvim-treesitter
nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
- WARNING: `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK: `node` found v18.12.1 (only needed for :TSInstallFromGrammar)
- OK: `git` executable found.
- OK: `gcc` executable found. Selected from { "gcc", "cc", "gcc", "clang", "cl", "zig" }
Version: gcc (GCC) 11.3.0
- OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
OS Info:
{
machine = "x86_64",
release = "5.15.90",
sysname = "Linux",
version = "#1-NixOS SMP Tue Jan 24 06:22:49 UTC 2023"
}
Parser/Features H L F I J
- nix ✓ ✓ ✓ . ✓
- http ✓ . . . ✓
- json ✓ ✓ ✓ ✓ .
- lua ✓ ✓ ✓ ✓ ✓
- rust ✓ ✓ ✓ ✓ ✓
- go ✓ ✓ ✓ ✓ ✓
Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
+) multiple parsers found, only one will be used
x) errors found in the query, try to run :TSUpdate {lang}
Output of nvim --version
NVIM v0.8.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by nixbld
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "
/nix/store/hhyajwm83gagrc6vpbanrarkg9h9cqq4-neovim-unwrapped-0.8.2/share/nvim
"
Additional context
Error
E5108: Error executing lua: ...plugged/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua:285: Column value outside range
stack traceback:
[C]: in function 'nvim_win_set_cursor'
...plugged/nvim-treesitter/lua/nvim-treesitter/ts_utils.lua:285: in function 'update_selection'
...r-textobjects/lua/nvim-treesitter/textobjects/select.lua:114: in function 'select_textobject'
...r-textobjects/lua/nvim-treesitter/textobjects/select.lua:184: in function <...r-textobjects/lua/nvim-treesitter/textobjects/select.lua:183>
E16: Invalid range
My treesitter config
require("nvim-treesitter.configs").setup {
ensure_installed = { "go", "http", "json", "lua", "nix", "rust" },
textobjects = {
select = {
enable = true,
lookahead = true, -- Jump forward like %
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
},
include_surrounding_whitespace = true,
},
},
}
Fixed by nvim-treesitter/nvim-treesitter#4260