fix(shared) better inner parameter selection
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 #700
Examples to cover by test:
vim.print(1, tonumber('1')) -- on `tonumber`
vim.print({1, '2'}, 3) -- on closing brace
vim.print({1, '2'}) -- on closing brace
Currently the change breaks function.outer selection (when the cursor is in the function body).
Currently the change breaks
function.outerselection (when the cursor is in the function body).
Fixed and added test cases.
I don't use neovim nightly so I could only find time now to test it..
Thanks for reporting it. It's definitely odd and in master branch, there is no such issue.
I'd like to accept this PR but I didn't follow much on main and the function you modified doesn't exist in master..
Can you investigate a little why this is an issue on main and not master? Thank you!
I noticed this PR hasn't progressed in a while. Would you be open to me helping complete it by addressing the requested changes?
I noticed this PR hasn't progressed in a while. Would you be open to me helping complete it by addressing the requested changes?
Please feel free to convert this PR to a more convincing version.
I have tested it on my side for a couple of days and have not faced any issues with any *.inner selection modes. I am not too sure on how to add changes to your PR. I will take a look.
$ make docs
NVIM_TS=.test-deps/nvim-treesitter .test-deps/nvim-linux-x86_64/nvim-linux-x86_64/bin/nvim -l scripts/update-readme.lua
E5113: Lua chunk: ...x-x86_64/share/nvim/runtime/lua/vim/treesitter/query.lua:372: No parser for language "apex"
stack traceback:
[C]: in function 'assert'
...x-x86_64/share/nvim/runtime/lua/vim/treesitter/query.lua:372: in function 'fn'
...inux-x86_64/share/nvim/runtime/lua/vim/func/_memoize.lua:78: in function 'fn'
...inux-x86_64/share/nvim/runtime/lua/vim/func/_memoize.lua:78: in function 'get'
./lua/nvim-treesitter-textobjects/shared.lua:424: in function 'fn'
./lua/nvim-treesitter-textobjects/shared.lua:42: in function 'available_textobjects'
scripts/update-readme.lua:38: in main chunk
make: *** [Makefile:124: docs] Error 1
so at the moment I cannot regenerate docs on my local side.
Looks like the apex parser is missing.
$ make docs NVIM_TS=.test-deps/nvim-treesitter .test-deps/nvim-linux-x86_64/nvim-linux-x86_64/bin/nvim -l scripts/update-readme.lua E5113: Lua chunk: ...x-x86_64/share/nvim/runtime/lua/vim/treesitter/query.lua:372: No parser for language "apex" stack traceback: [C]: in function 'assert' ...x-x86_64/share/nvim/runtime/lua/vim/treesitter/query.lua:372: in function 'fn' ...inux-x86_64/share/nvim/runtime/lua/vim/func/_memoize.lua:78: in function 'fn' ...inux-x86_64/share/nvim/runtime/lua/vim/func/_memoize.lua:78: in function 'get' ./lua/nvim-treesitter-textobjects/shared.lua:424: in function 'fn' ./lua/nvim-treesitter-textobjects/shared.lua:42: in function 'available_textobjects' scripts/update-readme.lua:38: in main chunk make: *** [Makefile:124: docs] Error 1so at the moment I cannot regenerate docs on my local side.
I think this is because you need to have all parsers installed, which must be the case on CI.
Can you rebase(!) on the latest main and check that it still works?
@przepompownia , can you do it?
Superseeded by #840