Skip to content

Commit c2d963e

Browse files
author
Aiday Marlen Kyzy
authored
Merge pull request microsoft#158728 from microsoft/aiday/issue158563
Making sticky scroll not experimental setting
2 parents 3cfc74c + a2cfb7c commit c2d963e

File tree

7 files changed

+198
-212
lines changed

7 files changed

+198
-212
lines changed

src/vs/editor/browser/viewParts/lines/viewLines.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
161161
this._horizontalRevealRequest = null;
162162

163163
// sticky scroll widget
164-
this._stickyScrollEnabled = options.get(EditorOption.experimental).stickyScroll.enabled;
165-
this._maxNumberStickyLines = options.get(EditorOption.experimental).stickyScroll.maxLineCount;
164+
this._stickyScrollEnabled = options.get(EditorOption.stickyScroll).enabled;
165+
this._maxNumberStickyLines = options.get(EditorOption.stickyScroll).maxLineCount;
166166
}
167167

168168
public override dispose(): void {
@@ -206,8 +206,8 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
206206
this._canUseLayerHinting = !options.get(EditorOption.disableLayerHinting);
207207

208208
// sticky scroll
209-
this._stickyScrollEnabled = options.get(EditorOption.experimental).stickyScroll.enabled;
210-
this._maxNumberStickyLines = options.get(EditorOption.experimental).stickyScroll.maxLineCount;
209+
this._stickyScrollEnabled = options.get(EditorOption.stickyScroll).enabled;
210+
this._maxNumberStickyLines = options.get(EditorOption.stickyScroll).maxLineCount;
211211

212212
applyFontInfo(this.domNode, fontInfo);
213213

src/vs/editor/common/config/editorOptions.ts

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ export interface IEditorOptions {
170170
*/
171171
scrollbar?: IEditorScrollbarOptions;
172172
/**
173-
* Control the behavior of experimental options
173+
* Control the behavior of sticky scroll options
174174
*/
175-
experimental?: IEditorExperimentalOptions;
175+
stickyScroll?: IEditorStickyScrollOptions;
176176
/**
177177
* Control the behavior and rendering of the minimap.
178178
*/
@@ -2512,61 +2512,56 @@ class EditorLightbulb extends BaseEditorOption<EditorOption.lightbulb, IEditorLi
25122512

25132513
//#endregion
25142514

2515-
//#region experimental
2515+
//#region stickyScroll
25162516

2517-
export interface IEditorExperimentalOptions {
2517+
export interface IEditorStickyScrollOptions {
25182518
/**
2519-
* Configuration options for editor sticky scroll
2519+
* Enable the sticky scroll
25202520
*/
2521-
stickyScroll?: {
2522-
/**
2523-
* Enable the sticky scroll
2524-
*/
2525-
enabled?: boolean;
2526-
maxLineCount?: number;
2527-
};
2528-
}
2521+
enabled?: boolean;
2522+
/**
2523+
* Maximum number of sticky lines to show
2524+
*/
2525+
maxLineCount?: number;
25292526

2530-
export interface EditorExperimentalOptions {
2531-
stickyScroll: {
2532-
enabled: boolean;
2533-
maxLineCount: number;
2534-
};
25352527
}
25362528

2537-
class EditorExperimental extends BaseEditorOption<EditorOption.experimental, IEditorExperimentalOptions, EditorExperimentalOptions> {
2529+
/**
2530+
* @internal
2531+
*/
2532+
export type EditorStickyScrollOptions = Readonly<Required<IEditorStickyScrollOptions>>;
2533+
2534+
class EditorStickyScroll extends BaseEditorOption<EditorOption.stickyScroll, IEditorStickyScrollOptions, EditorStickyScrollOptions> {
25382535

25392536
constructor() {
2540-
const defaults: EditorExperimentalOptions = { stickyScroll: { enabled: false, maxLineCount: 5 } };
2537+
const defaults: EditorStickyScrollOptions = { enabled: false, maxLineCount: 5 };
25412538
super(
2542-
EditorOption.experimental, 'experimental', defaults,
2539+
EditorOption.stickyScroll, 'stickyScroll', defaults,
25432540
{
2544-
'editor.experimental.stickyScroll.enabled': {
2541+
'editor.stickyScroll.enabled': {
25452542
type: 'boolean',
2546-
default: defaults.stickyScroll.enabled,
2547-
description: nls.localize('editor.experimental.stickyScroll', "Shows the nested current scopes during the scroll at the top of the editor.")
2543+
default: defaults.enabled,
2544+
description: nls.localize('editor.stickyScroll', "Shows the nested current scopes during the scroll at the top of the editor.")
25482545
},
2549-
'editor.experimental.stickyScroll.maxLineCount': {
2546+
'editor.stickyScroll.maxLineCount': {
25502547
type: 'number',
2551-
default: defaults.stickyScroll.maxLineCount,
2548+
default: defaults.maxLineCount,
25522549
minimum: 1,
25532550
maximum: 10,
2554-
description: nls.localize('editor.experimental.stickyScroll.', "Defines the maximum number of sticky lines to show.")
2551+
description: nls.localize('editor.stickyScroll.', "Defines the maximum number of sticky lines to show.")
25552552
},
25562553
}
25572554
);
25582555
}
25592556

2560-
public validate(_input: any): EditorExperimentalOptions {
2557+
public validate(_input: any): EditorStickyScrollOptions {
25612558
if (!_input || typeof _input !== 'object') {
25622559
return this.defaultValue;
25632560
}
2564-
const input = _input as IEditorExperimentalOptions;
2561+
const input = _input as IEditorStickyScrollOptions;
25652562
return {
2566-
stickyScroll: {
2567-
enabled: boolean(input.stickyScroll?.enabled, this.defaultValue.stickyScroll.enabled),
2568-
maxLineCount: EditorIntOption.clampedInt(input.stickyScroll?.maxLineCount, this.defaultValue.stickyScroll.maxLineCount, 1, 10),
2569-
}
2563+
enabled: boolean(input.enabled, this.defaultValue.enabled),
2564+
maxLineCount: EditorIntOption.clampedInt(input.maxLineCount, this.defaultValue.maxLineCount, 1, 10),
25702565
};
25712566
}
25722567
}
@@ -4567,7 +4562,6 @@ export const enum EditorOption {
45674562
dragAndDrop,
45684563
dropIntoEditor,
45694564
emptySelectionClipboard,
4570-
experimental,
45714565
extraEditorClassName,
45724566
fastScrollSensitivity,
45734567
find,
@@ -4639,6 +4633,7 @@ export const enum EditorOption {
46394633
snippetSuggestions,
46404634
smartSelect,
46414635
smoothScrolling,
4636+
stickyScroll,
46424637
stickyTabStops,
46434638
stopRenderingLineAfter,
46444639
suggest,
@@ -4876,7 +4871,7 @@ export const EditorOptions = {
48764871
)),
48774872
emptySelectionClipboard: register(new EditorEmptySelectionClipboard()),
48784873
dropIntoEditor: register(new EditorDropIntoEditor()),
4879-
experimental: register(new EditorExperimental()),
4874+
stickyScroll: register(new EditorStickyScroll()),
48804875
extraEditorClassName: register(new EditorStringOption(
48814876
EditorOption.extraEditorClassName, 'extraEditorClassName', '',
48824877
)),

src/vs/editor/common/standalone/standaloneEnums.ts

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -206,78 +206,78 @@ export enum EditorOption {
206206
dragAndDrop = 31,
207207
dropIntoEditor = 32,
208208
emptySelectionClipboard = 33,
209-
experimental = 34,
210-
extraEditorClassName = 35,
211-
fastScrollSensitivity = 36,
212-
find = 37,
213-
fixedOverflowWidgets = 38,
214-
folding = 39,
215-
foldingStrategy = 40,
216-
foldingHighlight = 41,
217-
foldingImportsByDefault = 42,
218-
foldingMaximumRegions = 43,
219-
unfoldOnClickAfterEndOfLine = 44,
220-
fontFamily = 45,
221-
fontInfo = 46,
222-
fontLigatures = 47,
223-
fontSize = 48,
224-
fontWeight = 49,
225-
formatOnPaste = 50,
226-
formatOnType = 51,
227-
glyphMargin = 52,
228-
gotoLocation = 53,
229-
hideCursorInOverviewRuler = 54,
230-
hover = 55,
231-
inDiffEditor = 56,
232-
inlineSuggest = 57,
233-
letterSpacing = 58,
234-
lightbulb = 59,
235-
lineDecorationsWidth = 60,
236-
lineHeight = 61,
237-
lineNumbers = 62,
238-
lineNumbersMinChars = 63,
239-
linkedEditing = 64,
240-
links = 65,
241-
matchBrackets = 66,
242-
minimap = 67,
243-
mouseStyle = 68,
244-
mouseWheelScrollSensitivity = 69,
245-
mouseWheelZoom = 70,
246-
multiCursorMergeOverlapping = 71,
247-
multiCursorModifier = 72,
248-
multiCursorPaste = 73,
249-
occurrencesHighlight = 74,
250-
overviewRulerBorder = 75,
251-
overviewRulerLanes = 76,
252-
padding = 77,
253-
parameterHints = 78,
254-
peekWidgetDefaultFocus = 79,
255-
definitionLinkOpensInPeek = 80,
256-
quickSuggestions = 81,
257-
quickSuggestionsDelay = 82,
258-
readOnly = 83,
259-
renameOnType = 84,
260-
renderControlCharacters = 85,
261-
renderFinalNewline = 86,
262-
renderLineHighlight = 87,
263-
renderLineHighlightOnlyWhenFocus = 88,
264-
renderValidationDecorations = 89,
265-
renderWhitespace = 90,
266-
revealHorizontalRightPadding = 91,
267-
roundedSelection = 92,
268-
rulers = 93,
269-
scrollbar = 94,
270-
scrollBeyondLastColumn = 95,
271-
scrollBeyondLastLine = 96,
272-
scrollPredominantAxis = 97,
273-
selectionClipboard = 98,
274-
selectionHighlight = 99,
275-
selectOnLineNumbers = 100,
276-
showFoldingControls = 101,
277-
showUnused = 102,
278-
snippetSuggestions = 103,
279-
smartSelect = 104,
280-
smoothScrolling = 105,
209+
extraEditorClassName = 34,
210+
fastScrollSensitivity = 35,
211+
find = 36,
212+
fixedOverflowWidgets = 37,
213+
folding = 38,
214+
foldingStrategy = 39,
215+
foldingHighlight = 40,
216+
foldingImportsByDefault = 41,
217+
foldingMaximumRegions = 42,
218+
unfoldOnClickAfterEndOfLine = 43,
219+
fontFamily = 44,
220+
fontInfo = 45,
221+
fontLigatures = 46,
222+
fontSize = 47,
223+
fontWeight = 48,
224+
formatOnPaste = 49,
225+
formatOnType = 50,
226+
glyphMargin = 51,
227+
gotoLocation = 52,
228+
hideCursorInOverviewRuler = 53,
229+
hover = 54,
230+
inDiffEditor = 55,
231+
inlineSuggest = 56,
232+
letterSpacing = 57,
233+
lightbulb = 58,
234+
lineDecorationsWidth = 59,
235+
lineHeight = 60,
236+
lineNumbers = 61,
237+
lineNumbersMinChars = 62,
238+
linkedEditing = 63,
239+
links = 64,
240+
matchBrackets = 65,
241+
minimap = 66,
242+
mouseStyle = 67,
243+
mouseWheelScrollSensitivity = 68,
244+
mouseWheelZoom = 69,
245+
multiCursorMergeOverlapping = 70,
246+
multiCursorModifier = 71,
247+
multiCursorPaste = 72,
248+
occurrencesHighlight = 73,
249+
overviewRulerBorder = 74,
250+
overviewRulerLanes = 75,
251+
padding = 76,
252+
parameterHints = 77,
253+
peekWidgetDefaultFocus = 78,
254+
definitionLinkOpensInPeek = 79,
255+
quickSuggestions = 80,
256+
quickSuggestionsDelay = 81,
257+
readOnly = 82,
258+
renameOnType = 83,
259+
renderControlCharacters = 84,
260+
renderFinalNewline = 85,
261+
renderLineHighlight = 86,
262+
renderLineHighlightOnlyWhenFocus = 87,
263+
renderValidationDecorations = 88,
264+
renderWhitespace = 89,
265+
revealHorizontalRightPadding = 90,
266+
roundedSelection = 91,
267+
rulers = 92,
268+
scrollbar = 93,
269+
scrollBeyondLastColumn = 94,
270+
scrollBeyondLastLine = 95,
271+
scrollPredominantAxis = 96,
272+
selectionClipboard = 97,
273+
selectionHighlight = 98,
274+
selectOnLineNumbers = 99,
275+
showFoldingControls = 100,
276+
showUnused = 101,
277+
snippetSuggestions = 102,
278+
smartSelect = 103,
279+
smoothScrolling = 104,
280+
stickyScroll = 105,
281281
stickyTabStops = 106,
282282
stopRenderingLineAfter = 107,
283283
suggest = 108,

src/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class ToggleStickyScroll extends Action2 {
2121
},
2222
// Hardcoding due to import violation
2323
category: { value: localize('view', "View"), original: 'View' },
24-
toggled: ContextKeyExpr.equals('config.editor.experimental.stickyScroll.enabled', true),
24+
toggled: ContextKeyExpr.equals('config.editor.stickyScroll.enabled', true),
2525
menu: [
2626
{ id: MenuId.CommandPalette },
2727
{ id: MenuId.MenubarViewMenu, group: '5_editor', order: 6 },
@@ -31,7 +31,7 @@ export class ToggleStickyScroll extends Action2 {
3131

3232
override async run(accessor: ServicesAccessor): Promise<void> {
3333
const configurationService = accessor.get(IConfigurationService);
34-
const newValue = !configurationService.getValue('editor.experimental.stickyScroll.enabled');
35-
return configurationService.updateValue('editor.experimental.stickyScroll.enabled', newValue);
34+
const newValue = !configurationService.getValue('editor.stickyScroll.enabled');
35+
return configurationService.updateValue('editor.stickyScroll.enabled', newValue);
3636
}
3737
}

src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class StickyScrollController extends Disposable implements IEditorContrib
3232
this._widgetState = new StickyScrollWidgetState([], 0);
3333

3434
this._register(this._editor.onDidChangeConfiguration(e => {
35-
if (e.hasChanged(EditorOption.experimental)) {
35+
if (e.hasChanged(EditorOption.stickyScroll)) {
3636
this.readConfiguration();
3737
}
3838
}));
@@ -48,8 +48,8 @@ export class StickyScrollController extends Disposable implements IEditorContrib
4848
}
4949

5050
private readConfiguration() {
51-
const options = this._editor.getOption(EditorOption.experimental);
52-
if (options.stickyScroll.enabled === false) {
51+
const options = this._editor.getOption(EditorOption.stickyScroll);
52+
if (options.enabled === false) {
5353
this._editor.removeOverlayWidget(this._stickyScrollWidget);
5454
this._sessionStore.clear();
5555
return;
@@ -104,7 +104,7 @@ export class StickyScrollController extends Disposable implements IEditorContrib
104104

105105
public getScrollWidgetState(): StickyScrollWidgetState {
106106
const lineHeight: number = this._editor.getOption(EditorOption.lineHeight);
107-
const maxNumberStickyLines = this._editor.getOption(EditorOption.experimental).stickyScroll.maxLineCount;
107+
const maxNumberStickyLines = this._editor.getOption(EditorOption.stickyScroll).maxLineCount;
108108
const scrollTop: number = this._editor.getScrollTop();
109109
let lastLineRelativePosition: number = 0;
110110
const lineNumbers: number[] = [];

src/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ export class StickyLineCandidateProvider extends Disposable {
5151
this._languageFeaturesService = languageFeaturesService;
5252
this._updateSoon = this._register(new RunOnceScheduler(() => this.update(), 50));
5353
this._register(this._editor.onDidChangeConfiguration(e => {
54-
if (e.hasChanged(EditorOption.experimental)) {
54+
if (e.hasChanged(EditorOption.stickyScroll)) {
5555
this.readConfiguration();
5656
}
5757
}));
5858
this.readConfiguration();
5959
}
6060

6161
private readConfiguration() {
62-
const options = this._editor.getOption(EditorOption.experimental);
63-
if (options.stickyScroll.enabled === false) {
62+
const options = this._editor.getOption(EditorOption.stickyScroll);
63+
if (options.enabled === false) {
6464
this._sessionStore.clear();
6565
return;
6666
} else {

0 commit comments

Comments
 (0)