From 82ada4b9df2e9594e15c3a7b3dadf2ec7a0f4f80 Mon Sep 17 00:00:00 2001 From: Remi Schnekenburger Date: Tue, 19 Mar 2024 13:07:35 +0100 Subject: [PATCH] Extend TextEditorLineNumbersStyle with Interval (#13458) fixes #13447 contributed on behalf of STMicroelectronics Signed-off-by: Remi Schnekenburger --- CHANGELOG.md | 1 + packages/plugin-ext/src/main/browser/text-editor-main.ts | 8 +++++++- packages/plugin-ext/src/plugin/types-impl.ts | 3 ++- packages/plugin/src/theia.d.ts | 6 +++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f1d8b5eb9e55..21929257f8b64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ## not yet released - [core] Fix quickpick problems found in IDE testing [#13451](https://github.com/eclipse-theia/theia/pull/13451) - contributed on behalf of STMicroelectronics +- [plugin] Extend TextEditorLineNumbersStyle with Interval [#13458](https://github.com/eclipse-theia/theia/pull/13458) - contributed on behalf of STMicroelectronics [Breaking Changes:](#breaking_changes_not_yet_released) diff --git a/packages/plugin-ext/src/main/browser/text-editor-main.ts b/packages/plugin-ext/src/main/browser/text-editor-main.ts index 17656f9a85d2e..000e83509b276 100644 --- a/packages/plugin-ext/src/main/browser/text-editor-main.ts +++ b/packages/plugin-ext/src/main/browser/text-editor-main.ts @@ -151,7 +151,7 @@ export class TextEditorMain implements Disposable { } if (typeof newConfiguration.lineNumbers !== 'undefined') { - let lineNumbers: 'on' | 'off' | 'relative'; + let lineNumbers: 'on' | 'off' | 'relative' | 'interval'; switch (newConfiguration.lineNumbers) { case TextEditorLineNumbersStyle.On: lineNumbers = 'on'; @@ -159,6 +159,9 @@ export class TextEditorMain implements Disposable { case TextEditorLineNumbersStyle.Relative: lineNumbers = 'relative'; break; + case TextEditorLineNumbersStyle.Interval: + lineNumbers = 'interval'; + break; default: lineNumbers = 'off'; } @@ -400,6 +403,9 @@ export class TextEditorPropertiesMain { case monaco.editor.RenderLineNumbersType.Relative: lineNumbers = TextEditorLineNumbersStyle.Relative; break; + case monaco.editor.RenderLineNumbersType.Interval: + lineNumbers = TextEditorLineNumbersStyle.Interval; + break; default: lineNumbers = TextEditorLineNumbersStyle.On; break; diff --git a/packages/plugin-ext/src/plugin/types-impl.ts b/packages/plugin-ext/src/plugin/types-impl.ts index d89f2d78194fa..0a0e7c5611407 100644 --- a/packages/plugin-ext/src/plugin/types-impl.ts +++ b/packages/plugin-ext/src/plugin/types-impl.ts @@ -153,7 +153,8 @@ export enum StatusBarAlignment { export enum TextEditorLineNumbersStyle { Off = 0, On = 1, - Relative = 2 + Relative = 2, + Interval = 3 } /** diff --git a/packages/plugin/src/theia.d.ts b/packages/plugin/src/theia.d.ts index 5bc64b3a62598..e8015f3e5cce4 100644 --- a/packages/plugin/src/theia.d.ts +++ b/packages/plugin/src/theia.d.ts @@ -1897,7 +1897,11 @@ export module '@theia/plugin' { /** * 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 } /**