Change:
<!-- Do Not Delete This! featurerequesttemplate --<!-- Please read our Rules of Conduct: --<!-- Please search existing issues to avoid creating duplicates. --<!-- Describe the feature you'd like. --I love the new stickyScroll feature, but I work in some codebases with very deep nesting and 10 lines of scroll nesting isn't enough. I think the default value of 5 is perfectly appropriate, but I would like the option to increase this value to something larger. 20 lines would work in my case, but since this is a configured value, perhaps something even larger (30-50) would be acceptable. Here's an example of some test code that's hidden (note that I use either the folding or indentation providers since the outline provider isn't great for my language) Default of 5 ! User-configured with current max of 10 ! Proposed max of 20 ! It should, but often times we don't control the code we have to work with. It doesn't have to be the default, but if the user wants to opt in, let's allow them. There is already some handling to ensure that the sticky lines don't totally overrun the editor.
<!-- -96bd-47a8-a0e8- --This feature request is now a candidate for our backlog. The community has 60 days to the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our . Happy Coding!
Hey , thanks for triaging this. I did put up a PR that implements this fix (), does this still need to go through the community review process? It seems like either this aligns with the roadmap (it's not really a new feature or anything), or there's perhaps some reason for not wanting more than 10 lines of scroll.
Hi thank you for pinging me on it, I forgot to act on the PR. The change looks good and makes sense. We will probably merge this quite soon.
If I navigate to another file and back, the max setting seems to get ignored. I have the setting set to 20. !
Hmm, how are you navigating back and forth? I just checked out vscode/main and don't seem to have that issue.
On the latest Insiders
Hmm... very interesting I just installed the latest insiders: Version: 1.87.0-insider Commit: Date: 2024-02-21T05:47:26.790Z Electron: 27.3.2 ElectronBuildId: Chromium: 118.0.5993.159 18.17.1 V8: 11.8.172.18-electron.0 OS: Linux x64 6.1.77-2-MANJARO and things seem to work fine for me Do you have any thoughts on what I can do to reproduce this?
I am able to reproduce this issue. It is quite strange indeed, I will look into what is causing this.
I looked at the code and I believe this happens because we do not update the field in the constructor. Therefore in the first call to it is equal to and this causes an incorrect number of lines to be shown. On the next update of the state (for example on changing tabs), the correct number of lines is shown. I made a PR to fix this. It is to be noted that even if you specify that you'd like to show at most 20 lines in the view, this number is capped by the number of lines that can be shown in 1/4th of the height of the editor. This is because we do not want the editor to be overwhelmed by editor sticky scroll. This is why despite setting 20 lines max, you see less lines than this.

Discussion:
this._register(this._stickyLineCandidateProvider); this._widgetState = new StickyScrollWidgetState([], [], 0); <ins> this._onDidResize(); </ins> this._readConfiguration(); const stickyScrollDomNode = this._stickyScrollWidget.getDomNode(); this._register(this._editor.onDidChangeConfiguration(e => {

enabled: true, maxLineCount: 5, defaultModel: 'outlineModel' <del> }, serviceCollection: serviceCollection </del> <ins> }, envConfig: { outerHeight: 500 }, serviceCollection: serviceCollection </ins> }, async (editor, _viewModel, instantiationService) => { const languageService = instantiationService.get(ILanguageFeaturesService); const languageConfigurationService = instantiationService.get(ILanguageConfigurationService);

enabled: true, maxLineCount: 5, defaultModel: 'outlineModel' <del> }, serviceCollection </del> <ins> }, envConfig: { outerHeight: 500 }, serviceCollection </ins> }, async (editor, viewModel, instantiationService) => { const stickyScrollController: StickyScrollController = editor.registerAndInstantiateContribution(StickyScrollController.ID, StickyScrollController);

enabled: true, maxLineCount: 5, defaultModel: 'outlineModel' <del> }, serviceCollection </del> <ins> }, envConfig: { outerHeight: 500 }, serviceCollection </ins> }, async (editor, _viewModel, instantiationService) => { const stickyScrollController: StickyScrollController = editor.registerAndInstantiateContribution(StickyScrollController.ID, StickyScrollController);

*--------------------------------------------------------------------------------------------*/ import { EditorConfiguration, IEnvConfiguration } from 'vs/editor/browser/config/editorConfiguration'; <del> import { EditorFontLigatures, EditorFontVariations, IEditorOptions } from 'vs/editor/common/config/editorOptions'; </del> <ins> import { EditorFontLigatures, EditorFontVariations } from 'vs/editor/common/config/editorOptions'; </ins> import { BareFontInfo, FontInfo } from 'vs/editor/common/config/fontInfo'; <ins> import { TestCodeEditorCreationOptions } from 'vs/editor/test/browser/testCodeEditor'; </ins> import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility'; import { TestAccessibilityService } from 'vs/platform/accessibility/test/common/testAccessibilityService'; export class TestConfiguration extends EditorConfiguration { <del> constructor(opts: IEditorOptions) { </del> <ins> constructor(opts: Readonly<TestCodeEditorCreationOptions>) { </ins> super(false, opts, null, new TestAccessibilityService()); } protected override _readEnvConfiguration(): IEnvConfiguration { <ins> const envConfig = (this.getRawOptions() as TestCodeEditorCreationOptions).envConfig; </ins> return { <del> extraEditorClassName: '', outerWidth: 100, outerHeight: 100, emptySelectionClipboard: true, pixelRatio: 1, accessibilitySupport: AccessibilitySupport.Unknown </del> <ins> extraEditorClassName: envConfig?.extraEditorClassName ?? '', outerWidth: envConfig?.outerWidth ?? 100, outerHeight: envConfig?.outerHeight ?? 100, emptySelectionClipboard: envConfig?.emptySelectionClipboard ?? true, pixelRatio: envConfig?.pixelRatio ?? 1, accessibilitySupport: envConfig?.accessibilitySupport ?? AccessibilitySupport.Unknown </ins> }; }

import { DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle'; import { mock } from 'vs/base/test/common/mock'; <del> import { EditorConfiguration, IEditorConstructionOptions } from 'vs/editor/browser/config/editorConfiguration'; </del> <ins> import { EditorConfiguration } from 'vs/editor/browser/config/editorConfiguration'; </ins> import { IActiveCodeEditor, ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { View } from 'vs/editor/browser/view';

import { TestEditorWorkerService } from 'vs/editor/test/common/services/testEditorWorkerService'; import { TestTextResourcePropertiesService } from 'vs/editor/test/common/services/testTextResourcePropertiesService'; import { instantiateTextModel } from 'vs/editor/test/common/testTextModel'; <del> import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; </del> <ins> import { AccessibilitySupport, IAccessibilityService } from 'vs/platform/accessibility/common/accessibility'; </ins> import { TestAccessibilityService } from 'vs/platform/accessibility/test/common/testAccessibilityService'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { TestClipboardService } from 'vs/platform/clipboard/test/common/testClipboardService';

export class TestCodeEditor extends CodeEditorWidget implements ICodeEditor { //#region testing overrides <del> protected override _createConfiguration(isSimpleWidget: boolean, options: Readonly<IEditorConstructionOptions>): EditorConfiguration { </del> <ins> protected override _createConfiguration(isSimpleWidget: boolean, options: Readonly<TestCodeEditorCreationOptions>): EditorConfiguration { </ins> return new TestConfiguration(options); } protected override _createView(viewModel: ViewModel): [View, boolean] {

* Defaults to true. */ hasTextFocus?: boolean; <ins> /** * Env configuration */ envConfig?: ITestEnvConfiguration; </ins> } export interface TestCodeEditorInstantiationOptions extends TestCodeEditorCreationOptions {

serviceCollection?: ServiceCollection; } <ins> export interface ITestEnvConfiguration { extraEditorClassName?: string; outerWidth?: number; outerHeight?: number; emptySelectionClipboard?: boolean; pixelRatio?: number; accessibilitySupport?: AccessibilitySupport; } </ins> export function withTestCodeEditor(text: ITextModel | string | string[] | ITextBufferFactory, options: TestCodeEditorInstantiationOptions, callback: (editor: ITestCodeEditor, viewModel: ViewModel, instantiationService: TestInstantiationService) => void): void { return _withTestCodeEditor(text, options, callback); }