未验证 提交 e4544962 编写于 作者: A Alexandru Dima 提交者: GitHub

Merge pull request #49298 from CoenraadS/highlightActiveIndentGuide

Add setting for highlightActiveIndentGuide #49148
......@@ -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;
......
......@@ -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'],
......
......@@ -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,
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册