Skip to content
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

Extend variants for tree-sitter textobject motions #3263

Closed
the-mikedavis opened this issue Jul 30, 2022 · 1 comment · Fixed by #3266
Closed

Extend variants for tree-sitter textobject motions #3263

the-mikedavis opened this issue Jul 30, 2022 · 1 comment · Fixed by #3266
Assignees
Labels
A-helix-term Area: Helix term improvements A-tree-sitter Area: Tree-sitter C-enhancement Category: Improvements

Comments

@the-mikedavis
Copy link
Member

the-mikedavis commented Jul 30, 2022

Tree-sitter based textobject motions (for example ]f/[f) do not currently have different implementations between normal mode and select mode (v).

The behavior of these motions in select mode is worth some discussion. I see two options:

  1. Like ]p/[p or w/b in select mode, they should keep the anchor and move the head. This "extend" behavior is the normal behavior of motions in select mode. There is prior implementation-work for this behavior: Include treesitter objects in select mode #2802. (I'm looking at pulling this across the finish line now.)
  2. Like n/N, they should add new selections containing the next/previous textobject.

Option 2 is a bit unconventional (n/N is the only other that uses this behavior off the top of my head) but I think it would be more useful. Tree-sitter textobjects may not be contiguous in a file in the same way paragraphs are (by ]p/[p's definitions), so I think v]f would select other text between two function definitions I would not want. Even if this is not selected as the correct behavior, it might be good to adding separate commands that implement this behavior.

@the-mikedavis the-mikedavis added C-enhancement Category: Improvements A-tree-sitter Area: Tree-sitter A-helix-term Area: Helix term improvements labels Jul 30, 2022
@the-mikedavis the-mikedavis self-assigned this Jul 30, 2022
@the-mikedavis the-mikedavis linked a pull request Jul 30, 2022 that will close this issue
@the-mikedavis
Copy link
Member Author

the-mikedavis commented Jul 30, 2022

On second thought, option 2 may be better served by #3007

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements A-tree-sitter Area: Tree-sitter C-enhancement Category: Improvements
Projects
None yet
1 participant