From 3bef1553e688961bdd0d7849b837e27850ecc72f Mon Sep 17 00:00:00 2001 From: vince-fugnitto Date: Tue, 9 Mar 2021 15:28:11 -0500 Subject: [PATCH] monaco: fix gutter size due to lineNumbers The following commit updates the default `lineNumbersMinChars` similarly to vscode in order to produce a more appropriate gutter size (lineNumber size) in the editor. Reducing the size means that we can improve the readability of the code rather than have excessive gutters. Signed-off-by: vince-fugnitto --- packages/monaco/src/browser/monaco-editor-model.ts | 2 ++ packages/monaco/src/browser/monaco-editor-provider.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/monaco/src/browser/monaco-editor-model.ts b/packages/monaco/src/browser/monaco-editor-model.ts index 89a8193048a58..92b2586d03929 100644 --- a/packages/monaco/src/browser/monaco-editor-model.ts +++ b/packages/monaco/src/browser/monaco-editor-model.ts @@ -50,6 +50,8 @@ export class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { autoSave: 'on' | 'off' = 'on'; autoSaveDelay: number = 500; suppressOpenEditorWhenDirty = false; + lineNumbersMinChars = 3; + /* @deprecated there is no general save timeout, each participant should introduce a sensible timeout */ readonly onWillSaveLoopTimeOut = 1500; protected bufferSavedVersionId: number; diff --git a/packages/monaco/src/browser/monaco-editor-provider.ts b/packages/monaco/src/browser/monaco-editor-provider.ts index 40febe552ca85..6700f76ddfaf9 100644 --- a/packages/monaco/src/browser/monaco-editor-provider.ts +++ b/packages/monaco/src/browser/monaco-editor-provider.ts @@ -287,6 +287,7 @@ export class MonacoEditorProvider { const options = this.createOptions(this.preferencePrefixes, model.uri, model.languageId); options.model = model.textEditorModel; options.readOnly = model.readOnly; + options.lineNumbersMinChars = model.lineNumbersMinChars; return options; } protected updateMonacoEditorOptions(editor: MonacoEditor, event?: EditorPreferenceChange): void {