未验证 提交 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 { ...@@ -22,6 +22,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
private _spaceWidth: number; private _spaceWidth: number;
private _renderResult: string[]; private _renderResult: string[];
private _enabled: boolean; private _enabled: boolean;
private _activeIndentEnabled: boolean;
constructor(context: ViewContext) { constructor(context: ViewContext) {
super(); super();
...@@ -30,6 +31,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay { ...@@ -30,6 +31,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
this._lineHeight = this._context.configuration.editor.lineHeight; this._lineHeight = this._context.configuration.editor.lineHeight;
this._spaceWidth = this._context.configuration.editor.fontInfo.spaceWidth; this._spaceWidth = this._context.configuration.editor.fontInfo.spaceWidth;
this._enabled = this._context.configuration.editor.viewInfo.renderIndentGuides; this._enabled = this._context.configuration.editor.viewInfo.renderIndentGuides;
this._activeIndentEnabled = this._context.configuration.editor.viewInfo.highlightActiveIndentGuide;
this._renderResult = null; this._renderResult = null;
this._context.addEventHandler(this); this._context.addEventHandler(this);
...@@ -53,6 +55,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay { ...@@ -53,6 +55,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
} }
if (e.viewInfo) { if (e.viewInfo) {
this._enabled = this._context.configuration.editor.viewInfo.renderIndentGuides; this._enabled = this._context.configuration.editor.viewInfo.renderIndentGuides;
this._activeIndentEnabled = this._context.configuration.editor.viewInfo.highlightActiveIndentGuide;
} }
return true; return true;
} }
...@@ -114,7 +117,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay { ...@@ -114,7 +117,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
let activeIndentStartLineNumber = 0; let activeIndentStartLineNumber = 0;
let activeIndentEndLineNumber = 0; let activeIndentEndLineNumber = 0;
let activeIndentLevel = 0; let activeIndentLevel = 0;
if (this._primaryLineNumber) { if (this._activeIndentEnabled && this._primaryLineNumber) {
const activeIndentInfo = this._context.model.getActiveIndentGuide(this._primaryLineNumber, visibleStartLineNumber, visibleEndLineNumber); const activeIndentInfo = this._context.model.getActiveIndentGuide(this._primaryLineNumber, visibleStartLineNumber, visibleEndLineNumber);
activeIndentStartLineNumber = activeIndentInfo.startLineNumber; activeIndentStartLineNumber = activeIndentInfo.startLineNumber;
activeIndentEndLineNumber = activeIndentInfo.endLineNumber; activeIndentEndLineNumber = activeIndentInfo.endLineNumber;
......
...@@ -572,6 +572,11 @@ const editorConfiguration: IConfigurationNode = { ...@@ -572,6 +572,11 @@ const editorConfiguration: IConfigurationNode = {
default: EDITOR_DEFAULTS.viewInfo.renderIndentGuides, default: EDITOR_DEFAULTS.viewInfo.renderIndentGuides,
description: nls.localize('renderIndentGuides', "Controls whether the editor should render indent guides") 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': { 'editor.renderLineHighlight': {
'type': 'string', 'type': 'string',
'enum': ['none', 'gutter', 'line', 'all'], 'enum': ['none', 'gutter', 'line', 'all'],
......
...@@ -549,9 +549,14 @@ export interface IEditorOptions { ...@@ -549,9 +549,14 @@ export interface IEditorOptions {
renderControlCharacters?: boolean; renderControlCharacters?: boolean;
/** /**
* Enable rendering of indent guides. * Enable rendering of indent guides.
* Defaults to false. * Defaults to true.
*/ */
renderIndentGuides?: boolean; renderIndentGuides?: boolean;
/**
* Enable highlighting of the active indent guide.
* Defaults to true.
*/
highlightActiveIndentGuide?: boolean;
/** /**
* Enable rendering of current line highlight. * Enable rendering of current line highlight.
* Defaults to all. * Defaults to all.
...@@ -845,6 +850,7 @@ export interface InternalEditorViewOptions { ...@@ -845,6 +850,7 @@ export interface InternalEditorViewOptions {
readonly renderControlCharacters: boolean; readonly renderControlCharacters: boolean;
readonly fontLigatures: boolean; readonly fontLigatures: boolean;
readonly renderIndentGuides: boolean; readonly renderIndentGuides: boolean;
readonly highlightActiveIndentGuide: boolean;
readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all'; readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all';
readonly scrollbar: InternalEditorScrollbarOptions; readonly scrollbar: InternalEditorScrollbarOptions;
readonly minimap: InternalEditorMinimapOptions; readonly minimap: InternalEditorMinimapOptions;
...@@ -1131,6 +1137,7 @@ export class InternalEditorOptions { ...@@ -1131,6 +1137,7 @@ export class InternalEditorOptions {
&& a.renderControlCharacters === b.renderControlCharacters && a.renderControlCharacters === b.renderControlCharacters
&& a.fontLigatures === b.fontLigatures && a.fontLigatures === b.fontLigatures
&& a.renderIndentGuides === b.renderIndentGuides && a.renderIndentGuides === b.renderIndentGuides
&& a.highlightActiveIndentGuide === b.highlightActiveIndentGuide
&& a.renderLineHighlight === b.renderLineHighlight && a.renderLineHighlight === b.renderLineHighlight
&& this._equalsScrollbarOptions(a.scrollbar, b.scrollbar) && this._equalsScrollbarOptions(a.scrollbar, b.scrollbar)
&& this._equalsMinimapOptions(a.minimap, b.minimap) && this._equalsMinimapOptions(a.minimap, b.minimap)
...@@ -1748,6 +1755,7 @@ export class EditorOptionsValidator { ...@@ -1748,6 +1755,7 @@ export class EditorOptionsValidator {
renderControlCharacters: _boolean(opts.renderControlCharacters, defaults.renderControlCharacters), renderControlCharacters: _boolean(opts.renderControlCharacters, defaults.renderControlCharacters),
fontLigatures: fontLigatures, fontLigatures: fontLigatures,
renderIndentGuides: _boolean(opts.renderIndentGuides, defaults.renderIndentGuides), renderIndentGuides: _boolean(opts.renderIndentGuides, defaults.renderIndentGuides),
highlightActiveIndentGuide: _boolean(opts.highlightActiveIndentGuide, defaults.highlightActiveIndentGuide),
renderLineHighlight: renderLineHighlight, renderLineHighlight: renderLineHighlight,
scrollbar: scrollbar, scrollbar: scrollbar,
minimap: minimap, minimap: minimap,
...@@ -1862,6 +1870,7 @@ export class InternalEditorOptionsFactory { ...@@ -1862,6 +1870,7 @@ export class InternalEditorOptionsFactory {
renderControlCharacters: (accessibilityIsOn ? false : opts.viewInfo.renderControlCharacters), // DISABLED WHEN SCREEN READER IS ATTACHED renderControlCharacters: (accessibilityIsOn ? false : opts.viewInfo.renderControlCharacters), // DISABLED WHEN SCREEN READER IS ATTACHED
fontLigatures: (accessibilityIsOn ? false : opts.viewInfo.fontLigatures), // 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 renderIndentGuides: (accessibilityIsOn ? false : opts.viewInfo.renderIndentGuides), // DISABLED WHEN SCREEN READER IS ATTACHED
highlightActiveIndentGuide: opts.viewInfo.highlightActiveIndentGuide,
renderLineHighlight: opts.viewInfo.renderLineHighlight, renderLineHighlight: opts.viewInfo.renderLineHighlight,
scrollbar: opts.viewInfo.scrollbar, scrollbar: opts.viewInfo.scrollbar,
minimap: { minimap: {
...@@ -2315,6 +2324,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = { ...@@ -2315,6 +2324,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
renderControlCharacters: false, renderControlCharacters: false,
fontLigatures: false, fontLigatures: false,
renderIndentGuides: true, renderIndentGuides: true,
highlightActiveIndentGuide: true,
renderLineHighlight: 'line', renderLineHighlight: 'line',
scrollbar: { scrollbar: {
vertical: ScrollbarVisibility.Auto, vertical: ScrollbarVisibility.Auto,
......
...@@ -2891,9 +2891,14 @@ declare namespace monaco.editor { ...@@ -2891,9 +2891,14 @@ declare namespace monaco.editor {
renderControlCharacters?: boolean; renderControlCharacters?: boolean;
/** /**
* Enable rendering of indent guides. * Enable rendering of indent guides.
* Defaults to false. * Defaults to true.
*/ */
renderIndentGuides?: boolean; renderIndentGuides?: boolean;
/**
* Enable highlighting of the active indent guide.
* Defaults to true.
*/
highlightActiveIndentGuide?: boolean;
/** /**
* Enable rendering of current line highlight. * Enable rendering of current line highlight.
* Defaults to all. * Defaults to all.
...@@ -3124,6 +3129,7 @@ declare namespace monaco.editor { ...@@ -3124,6 +3129,7 @@ declare namespace monaco.editor {
readonly renderControlCharacters: boolean; readonly renderControlCharacters: boolean;
readonly fontLigatures: boolean; readonly fontLigatures: boolean;
readonly renderIndentGuides: boolean; readonly renderIndentGuides: boolean;
readonly highlightActiveIndentGuide: boolean;
readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all'; readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all';
readonly scrollbar: InternalEditorScrollbarOptions; readonly scrollbar: InternalEditorScrollbarOptions;
readonly minimap: InternalEditorMinimapOptions; readonly minimap: InternalEditorMinimapOptions;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册