Skip to content

Commit 89b035a

Browse files
author
Aiday Marlen Kyzy
authored
Merge pull request microsoft#155977 from aiday-mar/aiday/semanticScroll
Sticky scroll first version
2 parents 3e8a8ee + 242e0b3 commit 89b035a

File tree

8 files changed

+493
-59
lines changed

8 files changed

+493
-59
lines changed

src/tsec.exemptions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"vs/base/browser/defaultWorkerFactory.ts",
1616
"vs/base/worker/workerMain.ts",
1717
"vs/editor/contrib/markdownRenderer/browser/markdownRenderer.ts",
18+
"vs/editor/contrib/stickyScroll/browser/stickyScroll.ts",
1819
"vs/editor/browser/view/domLineBreaksComputer.ts",
1920
"vs/editor/browser/view/viewLayer.ts",
2021
"vs/editor/browser/widget/diffEditorWidget.ts",

src/vs/code/electron-sandbox/workbench/workbench.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<meta charset="utf-8" />
66
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote-resource:; media-src 'self'; frame-src 'self' vscode-webview:; object-src 'self'; script-src 'self' 'unsafe-eval' blob:; style-src 'self' 'unsafe-inline'; connect-src 'self' https: ws:; font-src 'self' https: vscode-remote-resource:;">
7-
<meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script'; trusted-types amdLoader cellRendererEditorText defaultWorkerFactory diffEditorWidget editorGhostText domLineBreaksComputer editorViewLayer diffReview dompurify notebookRenderer safeInnerHtml standaloneColorizer tokenizeToString;">
7+
<meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script'; trusted-types amdLoader cellRendererEditorText defaultWorkerFactory diffEditorWidget stickyScrollViewLayer editorGhostText domLineBreaksComputer editorViewLayer diffReview dompurify notebookRenderer safeInnerHtml standaloneColorizer tokenizeToString;">
88
</head>
99
<body aria-label="">
1010
</body>

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ export interface IEditorOptions {
169169
* Control the behavior and rendering of the scrollbars.
170170
*/
171171
scrollbar?: IEditorScrollbarOptions;
172+
/**
173+
* Control the behavior of the sticky scroll
174+
*/
175+
stickyScroll?: IEditorStickyScrollOptions;
172176
/**
173177
* Control the behavior and rendering of the minimap.
174178
*/
@@ -2504,6 +2508,54 @@ class EditorLightbulb extends BaseEditorOption<EditorOption.lightbulb, IEditorLi
25042508

25052509
//#endregion
25062510

2511+
//#region sticky scroll
2512+
2513+
/**
2514+
* Configuration options for editor sticky scroll
2515+
*/
2516+
2517+
export interface IEditorStickyScrollOptions {
2518+
/**
2519+
* Enable the sticky scroll
2520+
*/
2521+
enabled?: boolean;
2522+
}
2523+
2524+
/**
2525+
* @internal
2526+
*/
2527+
2528+
export type EditorStickyScrollOptions = Readonly<Required<IEditorStickyScrollOptions>>;
2529+
2530+
class EditorStickyScroll extends BaseEditorOption<EditorOption.stickyScroll, IEditorStickyScrollOptions, EditorStickyScrollOptions> {
2531+
2532+
constructor() {
2533+
const defaults: EditorStickyScrollOptions = { enabled: false };
2534+
super(
2535+
EditorOption.stickyScroll, 'stickyScroll', defaults,
2536+
{
2537+
'editor.stickyScroll.enabled': {
2538+
type: 'boolean',
2539+
default: defaults.enabled,
2540+
description: nls.localize('editor.stickyScroll', "Enables the sticky scroll in the editor.")
2541+
},
2542+
}
2543+
);
2544+
}
2545+
2546+
public validate(_input: any): EditorStickyScrollOptions {
2547+
if (!_input || typeof _input !== 'object') {
2548+
return this.defaultValue;
2549+
}
2550+
const input = _input as IEditorStickyScrollOptions;
2551+
return {
2552+
enabled: boolean(input.enabled, this.defaultValue.enabled)
2553+
};
2554+
}
2555+
}
2556+
2557+
//#endregion
2558+
25072559
//#region inlayHints
25082560

25092561
/**
@@ -4523,6 +4575,7 @@ export const enum EditorOption {
45234575
smartSelect,
45244576
smoothScrolling,
45254577
stickyTabStops,
4578+
stickyScroll,
45264579
stopRenderingLineAfter,
45274580
suggest,
45284581
suggestFontSize,
@@ -5079,6 +5132,7 @@ export const EditorOptions = {
50795132
EditorOption.smoothScrolling, 'smoothScrolling', false,
50805133
{ description: nls.localize('smoothScrolling', "Controls whether the editor will scroll using an animation.") }
50815134
)),
5135+
stickyScroll: register(new EditorStickyScroll()),
50825136
stopRenderingLineAfter: register(new EditorIntOption(
50835137
EditorOption.stopRenderingLineAfter, 'stopRenderingLineAfter',
50845138
10000, -1, Constants.MAX_SAFE_SMALL_INTEGER,

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

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -278,34 +278,35 @@ export enum EditorOption {
278278
smartSelect = 103,
279279
smoothScrolling = 104,
280280
stickyTabStops = 105,
281-
stopRenderingLineAfter = 106,
282-
suggest = 107,
283-
suggestFontSize = 108,
284-
suggestLineHeight = 109,
285-
suggestOnTriggerCharacters = 110,
286-
suggestSelection = 111,
287-
tabCompletion = 112,
288-
tabIndex = 113,
289-
unicodeHighlighting = 114,
290-
unusualLineTerminators = 115,
291-
useShadowDOM = 116,
292-
useTabStops = 117,
293-
wordSeparators = 118,
294-
wordWrap = 119,
295-
wordWrapBreakAfterCharacters = 120,
296-
wordWrapBreakBeforeCharacters = 121,
297-
wordWrapColumn = 122,
298-
wordWrapOverride1 = 123,
299-
wordWrapOverride2 = 124,
300-
wrappingIndent = 125,
301-
wrappingStrategy = 126,
302-
showDeprecated = 127,
303-
inlayHints = 128,
304-
editorClassName = 129,
305-
pixelRatio = 130,
306-
tabFocusMode = 131,
307-
layoutInfo = 132,
308-
wrappingInfo = 133
281+
stickyScroll = 106,
282+
stopRenderingLineAfter = 107,
283+
suggest = 108,
284+
suggestFontSize = 109,
285+
suggestLineHeight = 110,
286+
suggestOnTriggerCharacters = 111,
287+
suggestSelection = 112,
288+
tabCompletion = 113,
289+
tabIndex = 114,
290+
unicodeHighlighting = 115,
291+
unusualLineTerminators = 116,
292+
useShadowDOM = 117,
293+
useTabStops = 118,
294+
wordSeparators = 119,
295+
wordWrap = 120,
296+
wordWrapBreakAfterCharacters = 121,
297+
wordWrapBreakBeforeCharacters = 122,
298+
wordWrapColumn = 123,
299+
wordWrapOverride1 = 124,
300+
wordWrapOverride2 = 125,
301+
wrappingIndent = 126,
302+
wrappingStrategy = 127,
303+
showDeprecated = 128,
304+
inlayHints = 129,
305+
editorClassName = 130,
306+
pixelRatio = 131,
307+
tabFocusMode = 132,
308+
layoutInfo = 133,
309+
wrappingInfo = 134
309310
}
310311

311312
/**

0 commit comments

Comments
 (0)