-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[main]: parameter.inner
: selected smaller range than expected
#700
Comments
The master branch works as expected. But when I try your script to reproduce, the command E5108: Error executing lua: ...r-textobjects/lua/nvim-treesitter-textobjects/shared.lua:91: attempt t o index a nil value stack traceback: ...r-textobjects/lua/nvim-treesitter-textobjects/shared.lua:91: in function 'fn' ...r-textobjects/lua/nvim-treesitter-textobjects/shared.lua:39: in function 'get_query_matche s' ...r-textobjects/lua/nvim-treesitter-textobjects/shared.lua:167: in function 'fn' ...r/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:491: in function 'for_each_tree' ...r-textobjects/lua/nvim-treesitter-textobjects/shared.lua:164: in function 'get_capture_ran ges_recursively' ...r-textobjects/lua/nvim-treesitter-textobjects/shared.lua:359: in function 'textobject_at_p oint' ...r-textobjects/lua/nvim-treesitter-textobjects/select.lua:155: in function 'select_textobje ct' /data/data/com.termux/files/usr/tmp/init.lua:51: in function Press ENTER or type command to continue nvim --version
|
@Juhan280 I doubt that the |
From the nvim-treesitter-textobjects/queries/lua/textobjects.scm Lines 84 to 87 in aad2c8e
|
nvim-treesitter-textobjects/lua/nvim-treesitter-textobjects/shared.lua Lines 228 to 242 in aad2c8e
Having I tried diff --git a/lua/nvim-treesitter-textobjects/shared.lua b/lua/nvim-treesitter-textobjects/shared.lua
index 69a804c..69bd750 100644
--- a/lua/nvim-treesitter-textobjects/shared.lua
+++ b/lua/nvim-treesitter-textobjects/shared.lua
@@ -236,7 +236,7 @@ local function is_in_range(range, row, col)
end
local is_before_end_col_if_needed = true
if end_row == row then
- is_before_end_col_if_needed = col <= end_col
+ is_before_end_col_if_needed = col - 1 <= end_col
end
return is_in_rows and is_after_start_col_if_needed and is_before_end_col_if_needed
end but it breaks selection when the cursor is on the closing brace in |
parameter.inner
: selected smaller range than expected
The logic of including a point in a range needs `-1` end_col offset only if the point is from the cursor position but not from the end of another range. Fixes nvim-treesitter#700
The logic of including a point in a range needs `-1` end_col offset only if the point is from the cursor position but not from the end of another range. Fixes nvim-treesitter#700
Sometimes inner parameter selection ignores the current scope and selects the first parameter in the nested scope instead.
To Reproduce
Steps to reproduce the behavior:
init.lua:
nvim --clean -u init.lua init.lua
vip
(for me'1'
is selected){x}
and typevip
again (for me'x'
is selected).Expected behavior
Selected:
tonumber('1')
in step 2.{'x'}
in step 3.Output of
:checkhealth vim.treesitter
vim.treesitter: require("vim.treesitter.health").check()- Nvim runtime ABI version: 14
- OK Parser: c ABI: 14, path: .../nvim-from-src/lib/nvim/parser/c.so
- OK Parser: lua ABI: 14, path: .../nvim-from-src/lib/nvim/parser/lua.so
- OK Parser: markdown ABI: 14, path: .../nvim-from-src/lib/nvim/parser/markdown.so
- OK Parser: markdown_inline ABI: 14, path: .../nvim-from-src/lib/nvim/parser/markdown_inline.so
- OK Parser: query ABI: 14, path: .../nvim-from-src/lib/nvim/parser/query.so
- OK Parser: vim ABI: 14, path: .../nvim-from-src/lib/nvim/parser/vim.so
- OK Parser: vimdoc ABI: 14, path: .../nvim-from-src/lib/nvim/parser/vimdoc.so
- Can load WASM parsers: false
Output of
nvim --version
The text was updated successfully, but these errors were encountered: