-
Notifications
You must be signed in to change notification settings - Fork 235
fix(shared) better inner parameter selection #702
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
base: main
Are you sure you want to change the base?
Conversation
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
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 |
Fixed and added test cases. |
tests/select/python_spec.lua
Outdated
run:compare_cmds("aligned_indent.py", { row = 1, col = 0, cmds = { "d]a", "v]ad", "c]a" } }) | ||
run:compare_cmds("selection_mode.py", { row = 2, col = 4, cmds = { "dam", "dVam", "vamd", "Vamd" } }) | ||
run:compare_cmds("selection_mode.py", { row = 2, col = 4, cmds = { "dam", "dVam", "vamd", "Vamd", "dG" } }) | ||
run:compare_cmds("selection_mode.py", { row = 3, col = 8, cmds = { "kdG", "dam", "dVam", "vamd", "Vamd" } }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dG
, kdG
motions break when the reference code changes slightly. Maybe better if you do something like d]M
which is more meaningful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My intention was comparing the plugin action with something with something independent, but still reliable. IIRC the test compares results and expect only equation or only difference. In the former case I got passed test when all keystrokes gave the same bad result. While the test is defined as now, let allow to compare with something reliable (line 25 alraedy contains d;
).
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 I'd like to accept this PR but I didn't follow much on Can you investigate a little why this is an issue on main and not master? Thank you! |
---@param end_col_offset integer? | ||
---@return boolean | ||
local function is_in_range(range, row, col) | ||
local function is_in_range(range, row, col, end_col_offset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a brief comment on why the end_col_offset is needed (in what situation,) and a link to the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a brief comment on why the end_col_offset is needed (in what situation,) and a link to the issue.
@przepompownia , can you address the requested comments by @kiyoon ?
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 |
so at the moment I cannot regenerate docs on my local side. |
Looks like the apex parser is missing.
I think this is because you need to have all parsers installed, which must be the case on CI. |
The logic of including a point in a range needs
-1
end_col offsetonly if the point is from the cursor position
but not from the end of another range.
Fixes #700