Replies: 2 comments
-
Same problem, I often used "editor.action.smartSelect" in vscode. So I'm also wondering if this can be configured somehow. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I dug a little deeper and it seems like it just "walks up" the tree-sitter hierarchy, that does not include the line and the step inside the curly braces. Something tells me it dramatically complicates this request... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone,
One of the features I frequently use in JetBrains IDEs is "grow selection" and "shrink selection." Zed provides similar commands with
SelectLargerSyntaxNode
andSelectSmallerSyntaxNode
, but they tend to skip certain steps, which makes them less intuitive and, overall, less consistent.For example, consider the following TypeScript code snippet:
If I place the caret inside world and repeatedly use SelectLargerSyntaxNode, this is the sequence of selections I get:
So far, this behavior is perfect. However, the next selection skips directly to this:
Notice that it skips two critical selections:
This behavior is not consistent with how other parentheses and quotes are treated (where the content inside is selected first, followed by the outer structure).
In case you're wondering about the practical use case—when I want to modify the contents of a function or method, I usually select one of the lines within the function, expand the selection, and start typing immediately. With the current behavior, I have to delete the existing content, then manually add brackets (if I start typing a bracket without deleting first, it will just wrap the content in a new set of brackets), and then hit enter to move the caret to a new line (since the {} is now on the same line).
Is there a way to improve the SelectLargerSyntaxNode to make the selection process more consistent? Thank you.
Beta Was this translation helpful? Give feedback.
All reactions