diff --git a/src/vs/editor/browser/viewParts/indentGuides/indentGuides.ts b/src/vs/editor/browser/viewParts/indentGuides/indentGuides.ts index 7509cb3f777c4b6f5a69cc2c3ed05624e6635c8b..aef3582c374f011dad4be6b183417f7c08ceb56b 100644 --- a/src/vs/editor/browser/viewParts/indentGuides/indentGuides.ts +++ b/src/vs/editor/browser/viewParts/indentGuides/indentGuides.ts @@ -22,6 +22,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay { private _spaceWidth: number; private _renderResult: string[]; private _enabled: boolean; + private _activeIndentEnabled: boolean; constructor(context: ViewContext) { super(); @@ -30,6 +31,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay { this._lineHeight = this._context.configuration.editor.lineHeight; this._spaceWidth = this._context.configuration.editor.fontInfo.spaceWidth; this._enabled = this._context.configuration.editor.viewInfo.renderIndentGuides; + this._activeIndentEnabled = this._context.configuration.editor.viewInfo.highlightActiveIndentGuide; this._renderResult = null; this._context.addEventHandler(this); @@ -53,6 +55,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay { } if (e.viewInfo) { this._enabled = this._context.configuration.editor.viewInfo.renderIndentGuides; + this._activeIndentEnabled = this._context.configuration.editor.viewInfo.highlightActiveIndentGuide; } return true; } @@ -114,7 +117,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay { let activeIndentStartLineNumber = 0; let activeIndentEndLineNumber = 0; let activeIndentLevel = 0; - if (this._primaryLineNumber) { + if (this._activeIndentEnabled && this._primaryLineNumber) { const activeIndentInfo = this._context.model.getActiveIndentGuide(this._primaryLineNumber, visibleStartLineNumber, visibleEndLineNumber); activeIndentStartLineNumber = activeIndentInfo.startLineNumber; activeIndentEndLineNumber = activeIndentInfo.endLineNumber; diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 9077cbe130a6add3902f573db3b823b8dad8632e..7bbf39121f78dbc2d4da33fee4e92f67cf9c1457 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -572,6 +572,11 @@ const editorConfiguration: IConfigurationNode = { default: EDITOR_DEFAULTS.viewInfo.renderIndentGuides, description: nls.localize('renderIndentGuides', "Controls whether the editor should render indent guides") }, + 'editor.highlightActiveIndentGuide': { + 'type': 'boolean', + default: EDITOR_DEFAULTS.viewInfo.highlightActiveIndentGuide, + description: nls.localize('highlightActiveIndentGuide', "Controls whether the editor should highlight the active indent guide") + }, 'editor.renderLineHighlight': { 'type': 'string', 'enum': ['none', 'gutter', 'line', 'all'], diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 8a7b483c0e23e72e0ea0727dcfa0d949f89c3dba..81f616e224f97333837a79ee0bedbaa87d7f317f 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -549,9 +549,14 @@ export interface IEditorOptions { renderControlCharacters?: boolean; /** * Enable rendering of indent guides. - * Defaults to false. + * Defaults to true. */ renderIndentGuides?: boolean; + /** + * Enable highlighting of the active indent guide. + * Defaults to true. + */ + highlightActiveIndentGuide?: boolean; /** * Enable rendering of current line highlight. * Defaults to all. @@ -845,6 +850,7 @@ export interface InternalEditorViewOptions { readonly renderControlCharacters: boolean; readonly fontLigatures: boolean; readonly renderIndentGuides: boolean; + readonly highlightActiveIndentGuide: boolean; readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all'; readonly scrollbar: InternalEditorScrollbarOptions; readonly minimap: InternalEditorMinimapOptions; @@ -1131,6 +1137,7 @@ export class InternalEditorOptions { && a.renderControlCharacters === b.renderControlCharacters && a.fontLigatures === b.fontLigatures && a.renderIndentGuides === b.renderIndentGuides + && a.highlightActiveIndentGuide === b.highlightActiveIndentGuide && a.renderLineHighlight === b.renderLineHighlight && this._equalsScrollbarOptions(a.scrollbar, b.scrollbar) && this._equalsMinimapOptions(a.minimap, b.minimap) @@ -1748,6 +1755,7 @@ export class EditorOptionsValidator { renderControlCharacters: _boolean(opts.renderControlCharacters, defaults.renderControlCharacters), fontLigatures: fontLigatures, renderIndentGuides: _boolean(opts.renderIndentGuides, defaults.renderIndentGuides), + highlightActiveIndentGuide: _boolean(opts.highlightActiveIndentGuide, defaults.highlightActiveIndentGuide), renderLineHighlight: renderLineHighlight, scrollbar: scrollbar, minimap: minimap, @@ -1862,6 +1870,7 @@ export class InternalEditorOptionsFactory { renderControlCharacters: (accessibilityIsOn ? false : opts.viewInfo.renderControlCharacters), // DISABLED WHEN SCREEN READER IS ATTACHED fontLigatures: (accessibilityIsOn ? false : opts.viewInfo.fontLigatures), // DISABLED WHEN SCREEN READER IS ATTACHED renderIndentGuides: (accessibilityIsOn ? false : opts.viewInfo.renderIndentGuides), // DISABLED WHEN SCREEN READER IS ATTACHED + highlightActiveIndentGuide: opts.viewInfo.highlightActiveIndentGuide, renderLineHighlight: opts.viewInfo.renderLineHighlight, scrollbar: opts.viewInfo.scrollbar, minimap: { @@ -2315,6 +2324,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = { renderControlCharacters: false, fontLigatures: false, renderIndentGuides: true, + highlightActiveIndentGuide: true, renderLineHighlight: 'line', scrollbar: { vertical: ScrollbarVisibility.Auto, diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 3f50cc1a7fea8b423ebc814acede396786253cb2..3808fa5b956e5bd2e78dfdaa7961f4bac795bb41 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -2891,9 +2891,14 @@ declare namespace monaco.editor { renderControlCharacters?: boolean; /** * Enable rendering of indent guides. - * Defaults to false. + * Defaults to true. */ renderIndentGuides?: boolean; + /** + * Enable highlighting of the active indent guide. + * Defaults to true. + */ + highlightActiveIndentGuide?: boolean; /** * Enable rendering of current line highlight. * Defaults to all. @@ -3124,6 +3129,7 @@ declare namespace monaco.editor { readonly renderControlCharacters: boolean; readonly fontLigatures: boolean; readonly renderIndentGuides: boolean; + readonly highlightActiveIndentGuide: boolean; readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all'; readonly scrollbar: InternalEditorScrollbarOptions; readonly minimap: InternalEditorMinimapOptions;