From d708be4ae49cc3144c50d52dc9dcb5e0807a6f2f Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 29 Jul 2022 10:47:17 +0200 Subject: [PATCH] Fixes #156645: Change the sticky scroll option to `editor.experimental.stickyScroll` --- src/vs/editor/common/config/editorOptions.ts | 55 +++--- .../common/standalone/standaloneEnums.ts | 146 +++++++-------- .../stickyScroll/browser/stickyScroll.ts | 6 +- src/vs/monaco.d.ts | 172 +++++++++--------- 4 files changed, 195 insertions(+), 184 deletions(-) diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index b50d0d0e112..15b9d5cddd8 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -170,9 +170,9 @@ export interface IEditorOptions { */ scrollbar?: IEditorScrollbarOptions; /** - * Control the behavior of the sticky scroll + * Control the behavior of experimental options */ - stickyScroll?: IEditorStickyScrollOptions; + experimental?: IEditorExperimentalOptions; /** * Control the behavior and rendering of the minimap. */ @@ -2508,48 +2508,51 @@ class EditorLightbulb extends BaseEditorOption>; - -class EditorStickyScroll extends BaseEditorOption { +class EditorExperimental extends BaseEditorOption { constructor() { - const defaults: EditorStickyScrollOptions = { enabled: false }; + const defaults: EditorExperimentalOptions = { stickyScroll: { enabled: false } }; super( - EditorOption.stickyScroll, 'stickyScroll', defaults, + EditorOption.experimental, 'experimental', defaults, { - 'editor.stickyScroll.enabled': { + 'editor.experimental.stickyScroll.enabled': { type: 'boolean', - default: defaults.enabled, - description: nls.localize('editor.stickyScroll', "Shows the nested current scopes during the scroll at the top of the editor.") + default: defaults.stickyScroll.enabled, + description: nls.localize('editor.experimental.stickyScroll', "Shows the nested current scopes during the scroll at the top of the editor.") }, } ); } - public validate(_input: any): EditorStickyScrollOptions { + public validate(_input: any): EditorExperimentalOptions { if (!_input || typeof _input !== 'object') { return this.defaultValue; } - const input = _input as IEditorStickyScrollOptions; + const input = _input as IEditorExperimentalOptions; return { - enabled: boolean(input.enabled, this.defaultValue.enabled) + stickyScroll: { + enabled: boolean(input.stickyScroll?.enabled, this.defaultValue.stickyScroll.enabled) + } }; } } @@ -4550,6 +4553,7 @@ export const enum EditorOption { dragAndDrop, dropIntoEditor, emptySelectionClipboard, + experimental, extraEditorClassName, fastScrollSensitivity, find, @@ -4622,7 +4626,6 @@ export const enum EditorOption { smartSelect, smoothScrolling, stickyTabStops, - stickyScroll, stopRenderingLineAfter, suggest, suggestFontSize, @@ -4859,6 +4862,7 @@ export const EditorOptions = { )), emptySelectionClipboard: register(new EditorEmptySelectionClipboard()), dropIntoEditor: register(new EditorDropIntoEditor()), + experimental: register(new EditorExperimental()), extraEditorClassName: register(new EditorStringOption( EditorOption.extraEditorClassName, 'extraEditorClassName', '', )), @@ -5177,7 +5181,6 @@ export const EditorOptions = { EditorOption.smoothScrolling, 'smoothScrolling', false, { description: nls.localize('smoothScrolling', "Controls whether the editor will scroll using an animation.") } )), - stickyScroll: register(new EditorStickyScroll()), stopRenderingLineAfter: register(new EditorIntOption( EditorOption.stopRenderingLineAfter, 'stopRenderingLineAfter', 10000, -1, Constants.MAX_SAFE_SMALL_INTEGER, diff --git a/src/vs/editor/common/standalone/standaloneEnums.ts b/src/vs/editor/common/standalone/standaloneEnums.ts index c62e7fc404f..5b9c0195e7b 100644 --- a/src/vs/editor/common/standalone/standaloneEnums.ts +++ b/src/vs/editor/common/standalone/standaloneEnums.ts @@ -206,79 +206,79 @@ export enum EditorOption { dragAndDrop = 31, dropIntoEditor = 32, emptySelectionClipboard = 33, - extraEditorClassName = 34, - fastScrollSensitivity = 35, - find = 36, - fixedOverflowWidgets = 37, - folding = 38, - foldingStrategy = 39, - foldingHighlight = 40, - foldingImportsByDefault = 41, - foldingMaximumRegions = 42, - unfoldOnClickAfterEndOfLine = 43, - fontFamily = 44, - fontInfo = 45, - fontLigatures = 46, - fontSize = 47, - fontWeight = 48, - formatOnPaste = 49, - formatOnType = 50, - glyphMargin = 51, - gotoLocation = 52, - hideCursorInOverviewRuler = 53, - hover = 54, - inDiffEditor = 55, - inlineSuggest = 56, - letterSpacing = 57, - lightbulb = 58, - lineDecorationsWidth = 59, - lineHeight = 60, - lineNumbers = 61, - lineNumbersMinChars = 62, - linkedEditing = 63, - links = 64, - matchBrackets = 65, - minimap = 66, - mouseStyle = 67, - mouseWheelScrollSensitivity = 68, - mouseWheelZoom = 69, - multiCursorMergeOverlapping = 70, - multiCursorModifier = 71, - multiCursorPaste = 72, - occurrencesHighlight = 73, - overviewRulerBorder = 74, - overviewRulerLanes = 75, - padding = 76, - parameterHints = 77, - peekWidgetDefaultFocus = 78, - definitionLinkOpensInPeek = 79, - quickSuggestions = 80, - quickSuggestionsDelay = 81, - readOnly = 82, - renameOnType = 83, - renderControlCharacters = 84, - renderFinalNewline = 85, - renderLineHighlight = 86, - renderLineHighlightOnlyWhenFocus = 87, - renderValidationDecorations = 88, - renderWhitespace = 89, - revealHorizontalRightPadding = 90, - roundedSelection = 91, - rulers = 92, - scrollbar = 93, - scrollBeyondLastColumn = 94, - scrollBeyondLastLine = 95, - scrollPredominantAxis = 96, - selectionClipboard = 97, - selectionHighlight = 98, - selectOnLineNumbers = 99, - showFoldingControls = 100, - showUnused = 101, - snippetSuggestions = 102, - smartSelect = 103, - smoothScrolling = 104, - stickyTabStops = 105, - stickyScroll = 106, + experimental = 34, + extraEditorClassName = 35, + fastScrollSensitivity = 36, + find = 37, + fixedOverflowWidgets = 38, + folding = 39, + foldingStrategy = 40, + foldingHighlight = 41, + foldingImportsByDefault = 42, + foldingMaximumRegions = 43, + unfoldOnClickAfterEndOfLine = 44, + fontFamily = 45, + fontInfo = 46, + fontLigatures = 47, + fontSize = 48, + fontWeight = 49, + formatOnPaste = 50, + formatOnType = 51, + glyphMargin = 52, + gotoLocation = 53, + hideCursorInOverviewRuler = 54, + hover = 55, + inDiffEditor = 56, + inlineSuggest = 57, + letterSpacing = 58, + lightbulb = 59, + lineDecorationsWidth = 60, + lineHeight = 61, + lineNumbers = 62, + lineNumbersMinChars = 63, + linkedEditing = 64, + links = 65, + matchBrackets = 66, + minimap = 67, + mouseStyle = 68, + mouseWheelScrollSensitivity = 69, + mouseWheelZoom = 70, + multiCursorMergeOverlapping = 71, + multiCursorModifier = 72, + multiCursorPaste = 73, + occurrencesHighlight = 74, + overviewRulerBorder = 75, + overviewRulerLanes = 76, + padding = 77, + parameterHints = 78, + peekWidgetDefaultFocus = 79, + definitionLinkOpensInPeek = 80, + quickSuggestions = 81, + quickSuggestionsDelay = 82, + readOnly = 83, + renameOnType = 84, + renderControlCharacters = 85, + renderFinalNewline = 86, + renderLineHighlight = 87, + renderLineHighlightOnlyWhenFocus = 88, + renderValidationDecorations = 89, + renderWhitespace = 90, + revealHorizontalRightPadding = 91, + roundedSelection = 92, + rulers = 93, + scrollbar = 94, + scrollBeyondLastColumn = 95, + scrollBeyondLastLine = 96, + scrollPredominantAxis = 97, + selectionClipboard = 98, + selectionHighlight = 99, + selectOnLineNumbers = 100, + showFoldingControls = 101, + showUnused = 102, + snippetSuggestions = 103, + smartSelect = 104, + smoothScrolling = 105, + stickyTabStops = 106, stopRenderingLineAfter = 107, suggest = 108, suggestFontSize = 109, diff --git a/src/vs/editor/contrib/stickyScroll/browser/stickyScroll.ts b/src/vs/editor/contrib/stickyScroll/browser/stickyScroll.ts index c42d96dff27..d76b699dd54 100644 --- a/src/vs/editor/contrib/stickyScroll/browser/stickyScroll.ts +++ b/src/vs/editor/contrib/stickyScroll/browser/stickyScroll.ts @@ -43,7 +43,7 @@ class StickyScrollController extends Disposable implements IEditorContribution { this._languageFeaturesService = _languageFeaturesService; this.stickyScrollWidget = new StickyScrollWidget(this._editor); this._register(this._editor.onDidChangeConfiguration(e => { - if (e.hasChanged(EditorOption.stickyScroll)) { + if (e.hasChanged(EditorOption.experimental)) { this.onConfigurationChange(); } })); @@ -52,8 +52,8 @@ class StickyScrollController extends Disposable implements IEditorContribution { } private onConfigurationChange() { - const options = this._editor.getOption(EditorOption.stickyScroll); - if (options.enabled === false) { + const options = this._editor.getOption(EditorOption.experimental); + if (options.stickyScroll.enabled === false) { this.stickyScrollWidget.emptyRootNode(); this._editor.removeOverlayWidget(this.stickyScrollWidget); this._sessionStore.clear(); diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 91b72dd4d11..8b0f9bbc295 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -2947,9 +2947,9 @@ declare namespace monaco.editor { */ scrollbar?: IEditorScrollbarOptions; /** - * Control the behavior of the sticky scroll + * Control the behavior of experimental options */ - stickyScroll?: IEditorStickyScrollOptions; + experimental?: IEditorExperimentalOptions; /** * Control the behavior and rendering of the minimap. */ @@ -3808,14 +3808,22 @@ declare namespace monaco.editor { enabled?: boolean; } - /** - * Configuration options for editor sticky scroll - */ - export interface IEditorStickyScrollOptions { + export interface IEditorExperimentalOptions { /** - * Enable the sticky scroll + * Configuration options for editor sticky scroll */ - enabled?: boolean; + stickyScroll?: { + /** + * Enable the sticky scroll + */ + enabled?: boolean; + }; + } + + export interface EditorExperimentalOptions { + stickyScroll: { + enabled: boolean; + }; } /** @@ -4376,79 +4384,79 @@ declare namespace monaco.editor { dragAndDrop = 31, dropIntoEditor = 32, emptySelectionClipboard = 33, - extraEditorClassName = 34, - fastScrollSensitivity = 35, - find = 36, - fixedOverflowWidgets = 37, - folding = 38, - foldingStrategy = 39, - foldingHighlight = 40, - foldingImportsByDefault = 41, - foldingMaximumRegions = 42, - unfoldOnClickAfterEndOfLine = 43, - fontFamily = 44, - fontInfo = 45, - fontLigatures = 46, - fontSize = 47, - fontWeight = 48, - formatOnPaste = 49, - formatOnType = 50, - glyphMargin = 51, - gotoLocation = 52, - hideCursorInOverviewRuler = 53, - hover = 54, - inDiffEditor = 55, - inlineSuggest = 56, - letterSpacing = 57, - lightbulb = 58, - lineDecorationsWidth = 59, - lineHeight = 60, - lineNumbers = 61, - lineNumbersMinChars = 62, - linkedEditing = 63, - links = 64, - matchBrackets = 65, - minimap = 66, - mouseStyle = 67, - mouseWheelScrollSensitivity = 68, - mouseWheelZoom = 69, - multiCursorMergeOverlapping = 70, - multiCursorModifier = 71, - multiCursorPaste = 72, - occurrencesHighlight = 73, - overviewRulerBorder = 74, - overviewRulerLanes = 75, - padding = 76, - parameterHints = 77, - peekWidgetDefaultFocus = 78, - definitionLinkOpensInPeek = 79, - quickSuggestions = 80, - quickSuggestionsDelay = 81, - readOnly = 82, - renameOnType = 83, - renderControlCharacters = 84, - renderFinalNewline = 85, - renderLineHighlight = 86, - renderLineHighlightOnlyWhenFocus = 87, - renderValidationDecorations = 88, - renderWhitespace = 89, - revealHorizontalRightPadding = 90, - roundedSelection = 91, - rulers = 92, - scrollbar = 93, - scrollBeyondLastColumn = 94, - scrollBeyondLastLine = 95, - scrollPredominantAxis = 96, - selectionClipboard = 97, - selectionHighlight = 98, - selectOnLineNumbers = 99, - showFoldingControls = 100, - showUnused = 101, - snippetSuggestions = 102, - smartSelect = 103, - smoothScrolling = 104, - stickyTabStops = 105, - stickyScroll = 106, + experimental = 34, + extraEditorClassName = 35, + fastScrollSensitivity = 36, + find = 37, + fixedOverflowWidgets = 38, + folding = 39, + foldingStrategy = 40, + foldingHighlight = 41, + foldingImportsByDefault = 42, + foldingMaximumRegions = 43, + unfoldOnClickAfterEndOfLine = 44, + fontFamily = 45, + fontInfo = 46, + fontLigatures = 47, + fontSize = 48, + fontWeight = 49, + formatOnPaste = 50, + formatOnType = 51, + glyphMargin = 52, + gotoLocation = 53, + hideCursorInOverviewRuler = 54, + hover = 55, + inDiffEditor = 56, + inlineSuggest = 57, + letterSpacing = 58, + lightbulb = 59, + lineDecorationsWidth = 60, + lineHeight = 61, + lineNumbers = 62, + lineNumbersMinChars = 63, + linkedEditing = 64, + links = 65, + matchBrackets = 66, + minimap = 67, + mouseStyle = 68, + mouseWheelScrollSensitivity = 69, + mouseWheelZoom = 70, + multiCursorMergeOverlapping = 71, + multiCursorModifier = 72, + multiCursorPaste = 73, + occurrencesHighlight = 74, + overviewRulerBorder = 75, + overviewRulerLanes = 76, + padding = 77, + parameterHints = 78, + peekWidgetDefaultFocus = 79, + definitionLinkOpensInPeek = 80, + quickSuggestions = 81, + quickSuggestionsDelay = 82, + readOnly = 83, + renameOnType = 84, + renderControlCharacters = 85, + renderFinalNewline = 86, + renderLineHighlight = 87, + renderLineHighlightOnlyWhenFocus = 88, + renderValidationDecorations = 89, + renderWhitespace = 90, + revealHorizontalRightPadding = 91, + roundedSelection = 92, + rulers = 93, + scrollbar = 94, + scrollBeyondLastColumn = 95, + scrollBeyondLastLine = 96, + scrollPredominantAxis = 97, + selectionClipboard = 98, + selectionHighlight = 99, + selectOnLineNumbers = 100, + showFoldingControls = 101, + showUnused = 102, + snippetSuggestions = 103, + smartSelect = 104, + smoothScrolling = 105, + stickyTabStops = 106, stopRenderingLineAfter = 107, suggest = 108, suggestFontSize = 109, @@ -4515,6 +4523,7 @@ declare namespace monaco.editor { dragAndDrop: IEditorOption; emptySelectionClipboard: IEditorOption; dropIntoEditor: IEditorOption>>; + experimental: IEditorOption; extraEditorClassName: IEditorOption; fastScrollSensitivity: IEditorOption; find: IEditorOption>>; @@ -4587,7 +4596,6 @@ declare namespace monaco.editor { snippetSuggestions: IEditorOption; smartSelect: IEditorOption>>; smoothScrolling: IEditorOption; - stickyScroll: IEditorOption>>; stopRenderingLineAfter: IEditorOption; suggest: IEditorOption>>; inlineSuggest: IEditorOption>>;