Add commands to select function, class, block, etc.
Check for existing issues
- [X] Completed
Describe the feature
Originally from https://github.com/zed-industries/zed/discussions/6510
I know there are "editor::SelectLargerSyntaxNode" and "editor::SelectSmallerSyntaxNode" commands. Is currently selecting a function, class or a block (or even select region between current position and last position) directly supported now?
If applicable, add mockups / screenshots to help present your vision of the feature
No response
I was under the impression that the paragraph actions were the ones to select blocks.
@Moshyfawn Maybe. The idea here is to select the whole thing under current cursor by a single command. But it would also helpful to have commands like
- move the start of function / method / class (we already have 'block' / 'paragraph')
- move the end of function / method / class (we already have 'block' / 'paragraph')
to revive this a bit, i think a few lsp powered ones would be:
editor::SelectNextFunction
visually selects the next function within the buffer
fn foo() {<caret>
}
fn bar() {
}
expected selection
fn bar() {
}
editor::SelectPreviousFunction
fn foo() {
}
fn bar() {<caret>
}
expected selection
fn foo() {
}
editor::SelectNextComment
```rs
fn foo() {<caret>
}
/// Some comment
fn bar() {
}
expected selection
/// Some comment
editor::SelectPreviousComment
same as SelectNextComment but in reverse