editor: Go to previous and next symbol actions#50777
editor: Go to previous and next symbol actions#50777SomeoneToIgnore merged 4 commits intozed-industries:mainfrom
Conversation
6f6b21c to
685d38b
Compare
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
As commented by @\RemcoSmitsDev too, new code definitely benefits from less operations invoked: besides snapshots, there's something suspicious in how we want to list all outlines and sort them, that might take a while for large files like editor.rs itself.
Another concern is that we don't use symbol that much and seem to have somewhat similar methods already?
I'm particularly interested in SelectNextSyntaxNode and its Prev counterpart — how far it is from what's needed?
It seems that we can either rework it, or use a SyntaxNode-based name for the new action at least?
Ideally, we could try to reuse syntax_next_sibling and related methods to simplify the calculations.
Naming and approaches aside, the current implementation seems to loose track of its neighbours when placed on a blank line?
For example, here:
class A:
def f(self):
pass
def g(self):
pass
<CARET>
class B:
def f(self):
pass
def g(self):
pass
class C:
def f(self):
pass
def g(self):
passI cannot move anywhere using new actions, which looks like a bug worthy of a fix and a test.
Should we also allow wrapping over the editor's edge when we reach the first/last symbol?
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Thank you, looks like the snapshot situation had become better.
Regarding the wrap around and large file implications, let's merge and see how things work for now.
Overall, both are good to improve: for the wrap around, we could add a parameter into actions.

Closes discussion #34890
This is similar to the vim prev/next method/section motion, but more flexible because this follows the items in editor's outline (Tree sitter or LSP provided).
Before you mark this PR as ready for review, make sure that you have:
Release Notes:
editor::GoToPreviousSymbolandeditor::GoToNextSymbolactions to go to the previous and next outline symbol. This is either the tree sitter outline, or the LSP provided outline depending on the configuration.