This commit is contained in:
Henning Dieterichs 2022-04-21 13:28:26 +02:00
parent 26f019d919
commit 1ccee4ae21
No known key found for this signature in database
GPG key ID: 771381EFFDB9EC06
3 changed files with 13 additions and 6 deletions

View file

@ -190,7 +190,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
let activeIndentEndLineNumber = 0;
let activeIndentLevel = 0;
if (this._bracketPairGuideOptions.highlightActiveIndentation && activeCursorPosition) {
if (this._bracketPairGuideOptions.highlightActiveIndentation !== false && activeCursorPosition) {
const activeIndentInfo = this._context.viewModel.getActiveIndentGuide(activeCursorPosition.lineNumber, visibleStartLineNumber, visibleEndLineNumber);
activeIndentStartLineNumber = activeIndentInfo.startLineNumber;
activeIndentEndLineNumber = activeIndentInfo.endLineNumber;
@ -213,7 +213,7 @@ export class IndentGuidesOverlay extends DynamicViewOverlay {
const indentGuide = (indentLvl - 1) * indentSize + 1;
const isActive =
// Disable active indent guide if there are bracket guides.
bracketGuidesInLine.length === 0 &&
(this._bracketPairGuideOptions.highlightActiveIndentation === 'always' || bracketGuidesInLine.length === 0) &&
activeIndentStartLineNumber <= lineNumber &&
lineNumber <= activeIndentEndLineNumber &&
indentLvl === activeIndentLevel;

View file

@ -3693,7 +3693,7 @@ export interface IGuidesOptions {
* Enable highlighting of the active indent guide.
* Defaults to true.
*/
highlightActiveIndentation?: boolean;
highlightActiveIndentation?: boolean | 'always';
}
/**
@ -3751,8 +3751,15 @@ class GuideOptions extends BaseEditorOption<EditorOption.guides, IGuidesOptions,
description: nls.localize('editor.guides.indentation', "Controls whether the editor should render indent guides.")
},
'editor.guides.highlightActiveIndentation': {
type: 'boolean',
type: ['boolean', 'string'],
enum: [true, 'always', false],
enumDescriptions: [
nls.localize('editor.guides.highlightActiveIndentation.true', "Highlights the active indent guide."),
nls.localize('editor.guides.highlightActiveIndentation.always', "Highlights the active indent guide even if bracket guides are highlighted."),
nls.localize('editor.guides.highlightActiveIndentation.false', "Do not highlight the active indent guide."),
],
default: defaults.highlightActiveIndentation,
description: nls.localize('editor.guides.highlightActiveIndentation', "Controls whether the editor should highlight the active indent guide.")
}
}
@ -3770,7 +3777,7 @@ class GuideOptions extends BaseEditorOption<EditorOption.guides, IGuidesOptions,
highlightActiveBracketPair: boolean(input.highlightActiveBracketPair, this.defaultValue.highlightActiveBracketPair),
indentation: boolean(input.indentation, this.defaultValue.indentation),
highlightActiveIndentation: boolean(input.highlightActiveIndentation, this.defaultValue.highlightActiveIndentation),
highlightActiveIndentation: primitiveSet(input.highlightActiveIndentation, this.defaultValue.highlightActiveIndentation, [true, false, 'always']),
};
}
}

2
src/vs/monaco.d.ts vendored
View file

@ -4032,7 +4032,7 @@ declare namespace monaco.editor {
* Enable highlighting of the active indent guide.
* Defaults to true.
*/
highlightActiveIndentation?: boolean;
highlightActiveIndentation?: boolean | 'always';
}
/**