Fixes #156645: Change the sticky scroll option to editor.experimental.stickyScroll

This commit is contained in:
Alex Dima
2022-07-29 10:47:17 +02:00
parent e8ee2cf78f
commit d708be4ae4
4 changed files with 195 additions and 184 deletions
+29 -26
View File
@@ -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<EditorOption.lightbulb, IEditorLi
//#endregion
//#region sticky scroll
//#region experimental
/**
* 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;
};
}
/**
* @internal
*/
export interface EditorExperimentalOptions {
stickyScroll: {
enabled: boolean;
};
}
export type EditorStickyScrollOptions = Readonly<Required<IEditorStickyScrollOptions>>;
class EditorStickyScroll extends BaseEditorOption<EditorOption.stickyScroll, IEditorStickyScrollOptions, EditorStickyScrollOptions> {
class EditorExperimental extends BaseEditorOption<EditorOption.experimental, IEditorExperimentalOptions, EditorExperimentalOptions> {
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,
@@ -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,
@@ -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();
+90 -82
View File
@@ -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<EditorOption.dragAndDrop, boolean>;
emptySelectionClipboard: IEditorOption<EditorOption.emptySelectionClipboard, boolean>;
dropIntoEditor: IEditorOption<EditorOption.dropIntoEditor, Readonly<Required<IDropIntoEditorOptions>>>;
experimental: IEditorOption<EditorOption.experimental, EditorExperimentalOptions>;
extraEditorClassName: IEditorOption<EditorOption.extraEditorClassName, string>;
fastScrollSensitivity: IEditorOption<EditorOption.fastScrollSensitivity, number>;
find: IEditorOption<EditorOption.find, Readonly<Required<IEditorFindOptions>>>;
@@ -4587,7 +4596,6 @@ declare namespace monaco.editor {
snippetSuggestions: IEditorOption<EditorOption.snippetSuggestions, 'none' | 'top' | 'bottom' | 'inline'>;
smartSelect: IEditorOption<EditorOption.smartSelect, Readonly<Required<ISmartSelectOptions>>>;
smoothScrolling: IEditorOption<EditorOption.smoothScrolling, boolean>;
stickyScroll: IEditorOption<EditorOption.stickyScroll, Readonly<Required<IEditorStickyScrollOptions>>>;
stopRenderingLineAfter: IEditorOption<EditorOption.stopRenderingLineAfter, number>;
suggest: IEditorOption<EditorOption.suggest, Readonly<Required<ISuggestOptions>>>;
inlineSuggest: IEditorOption<EditorOption.inlineSuggest, Readonly<Required<IInlineSuggestOptions>>>;