editor: add experimental fold header detection for sticky scroll#299593
Open
dabravin wants to merge 1 commit intomicrosoft:mainfrom
Open
editor: add experimental fold header detection for sticky scroll#299593dabravin wants to merge 1 commit intomicrosoft:mainfrom
dabravin wants to merge 1 commit intomicrosoft:mainfrom
Conversation
012480e to
cf730d9
Compare
Author
|
@microsoft-github-policy-service agree |
cf730d9 to
8297930
Compare
a02a53c to
2c13b46
Compare
Introduce `editor.stickyScroll.foldHeaderDetection` (default: false,
tagged experimental) to walk back from the raw fold-start line to a
more meaningful scope header.
When enabled, the folding-based sticky scroll providers walk past lone
Allman-style `{` lines, blank lines, and trailing return-type lines
(`-> T`) to find the actual declaration line. A right-to-left bracket
scan then resolves multi-line signatures to their opening `(` line,
so the sticky strip shows `void foo(` rather than `{`.
The heuristic is a best-effort aid primarily for C++ and Rust. It has
no effect when the fold start is already the header line (K&R style,
Python, etc.), and falls back to the raw fold start on any ambiguous
structure. The feature flag lets affected users opt in without risk to
unrelated language workflows.
Closes microsoft#238568
2c13b46 to
3fca507
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #238568
Introduces
editor.stickyScroll.foldHeaderDetection- an opt-in experimental boolean (defaultfalse) that makes folding-based sticky scroll providers walk back from the raw fold-start line to find a more meaningful scope header.What it does when enabled:
{lines and any blank lines above them-> ReturnType) that appear between)and{in C++/Rust(lineResult: instead of the sticky strip showing stacked
{characters, it shows the actual declaration —void foo(int x, int y)or theif (that opened a multi-line condition.What it does not change:
void foo() {) - fold start is already the header line, no walk-back occurs{lines, no walk-back triggeredfalse, zero impact on existing usersScope
src/vs/editor/common/config/editorOptions.tsfoldHeaderDetectionfield, default, schema entry withtags: ['experimental'], validatesrc/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.ts_fromFoldingRegions; extracted helpers_findFoldHeaderLineand_findSignatureOpeningLinewith full JSDocsrc/vs/editor/contrib/stickyScroll/test/browser/stickyScroll.test.tssrc/vs/monaco.d.tsTest plan
false(default), sticky scroll unchanged"editor.stickyScroll.foldHeaderDetection": true- sticky strip walks back to function signature linesstickyScrollin Settings UI - new entry appears tagged (Experimental)