From 3f7e44287c35e0df549ed6e07273582ce3544c8a Mon Sep 17 00:00:00 2001 From: Drew Pirrone-Brusse Date: Wed, 31 Jan 2024 06:05:59 -0500 Subject: [PATCH] Extend TextEditorLineNumbersStyle with Interval (#198787) --- src/vs/workbench/api/browser/mainThreadEditor.ts | 5 ++++- src/vs/workbench/api/common/extHostTypeConverters.ts | 4 ++++ src/vs/workbench/api/common/extHostTypes.ts | 3 ++- src/vscode-dts/vscode.d.ts | 6 +++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadEditor.ts b/src/vs/workbench/api/browser/mainThreadEditor.ts index b56ab1cb970aa..575c403378775 100644 --- a/src/vs/workbench/api/browser/mainThreadEditor.ts +++ b/src/vs/workbench/api/browser/mainThreadEditor.ts @@ -400,7 +400,7 @@ export class MainThreadTextEditor { } if (typeof newConfiguration.lineNumbers !== 'undefined') { - let lineNumbers: 'on' | 'off' | 'relative'; + let lineNumbers: 'on' | 'off' | 'relative' | 'interval'; switch (newConfiguration.lineNumbers) { case RenderLineNumbersType.On: lineNumbers = 'on'; @@ -408,6 +408,9 @@ export class MainThreadTextEditor { case RenderLineNumbersType.Relative: lineNumbers = 'relative'; break; + case RenderLineNumbersType.Interval: + lineNumbers = 'interval'; + break; default: lineNumbers = 'off'; } diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index 62d20bbea372f..1afcc8102e89d 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -1379,6 +1379,8 @@ export namespace TextEditorLineNumbersStyle { return RenderLineNumbersType.Off; case types.TextEditorLineNumbersStyle.Relative: return RenderLineNumbersType.Relative; + case types.TextEditorLineNumbersStyle.Interval: + return RenderLineNumbersType.Interval; case types.TextEditorLineNumbersStyle.On: default: return RenderLineNumbersType.On; @@ -1390,6 +1392,8 @@ export namespace TextEditorLineNumbersStyle { return types.TextEditorLineNumbersStyle.Off; case RenderLineNumbersType.Relative: return types.TextEditorLineNumbersStyle.Relative; + case RenderLineNumbersType.Interval: + return types.TextEditorLineNumbersStyle.Interval; case RenderLineNumbersType.On: default: return types.TextEditorLineNumbersStyle.On; diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index b67a8408f8e9c..2b4dd7f530d36 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -1821,7 +1821,8 @@ export function asStatusBarItemIdentifier(extension: ExtensionIdentifier, id: st export enum TextEditorLineNumbersStyle { Off = 0, On = 1, - Relative = 2 + Relative = 2, + Interval = 3 } export enum TextDocumentSaveReason { diff --git a/src/vscode-dts/vscode.d.ts b/src/vscode-dts/vscode.d.ts index bc0e61bbf1d11..a8fef891e89a1 100644 --- a/src/vscode-dts/vscode.d.ts +++ b/src/vscode-dts/vscode.d.ts @@ -657,7 +657,11 @@ declare module 'vscode' { /** * Render the line numbers with values relative to the primary cursor location. */ - Relative = 2 + Relative = 2, + /** + * Render the line numbers on every 10th line number. + */ + Interval = 3, } /**