editor: Implement Go to next/prev Document Highlight (#35994)
Closes #21193 Closes #14703 Having the ability to navigate directly to the next symbolHighlight/reference lets you follow the data flow of a variable. If you highlight the function itself (depending on the LSP), you can also navigate to all returns. Note that this is a different feature from navigating to the next match, as that is not language-context aware. For example, if you have a var named foo it would also navigate to an unrelated variable fooBar. Here's how this patch works: - The editor struct has a background_highlights. - Collect all highlights with the keys [DocumentHighlightRead, DocumentHighlightWrite] - Depending on the direction, move the cursor to the next or previous highlight relative to the current position. Release Notes: - Added `editor::GoToNextDocumentHighlight` and `editor::GoToPreviousDocumentHighlight` to navigate to the next LSP document highlight. Useful for navigating to the next usage of a certain symbol.
This commit is contained in:
@@ -493,6 +493,10 @@ actions!(
|
||||
GoToTypeDefinition,
|
||||
/// Goes to type definition in a split pane.
|
||||
GoToTypeDefinitionSplit,
|
||||
/// Goes to the next document highlight.
|
||||
GoToNextDocumentHighlight,
|
||||
/// Goes to the previous document highlight.
|
||||
GoToPreviousDocumentHighlight,
|
||||
/// Scrolls down by half a page.
|
||||
HalfPageDown,
|
||||
/// Scrolls up by half a page.
|
||||
|
||||
Reference in New Issue
Block a user