提交 76325786 编写于 作者: C Chirag Bhatia

Fixes #16424 - Added option to toggle matching brackets highlighter

上级 12992d3c
......@@ -301,6 +301,7 @@ class InternalEditorOptionsHelper {
selectionHighlight: toBoolean(opts.selectionHighlight),
codeLens: opts.referenceInfos && opts.codeLens,
folding: toBoolean(opts.folding),
highlightMatchingBrackets: toBoolean(opts.highlightMatchingBrackets),
});
return new editorCommon.InternalEditorOptions({
......@@ -792,6 +793,11 @@ const editorConfiguration: IConfigurationNode = {
'default': DefaultConfig.editor.folding,
'description': nls.localize('folding', "Controls whether the editor has code folding enabled")
},
'editor.highlightMatchingBrackets': {
'type': 'boolean',
'default': true,
'description': nls.localize('highlightMatchingBrackets', "Highlight matching brackets when one of them is selected.")
},
'editor.glyphMargin': {
'type': 'boolean',
'default': DefaultConfig.editor.glyphMargin,
......
......@@ -103,6 +103,7 @@ class ConfigClass implements IConfiguration {
renderIndentGuides: false,
renderLineHighlight: 'line',
useTabStops: true,
highlightMatchingBrackets: true,
fontFamily: (
platform.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY)
......
......@@ -464,6 +464,11 @@ export interface IEditorOptions {
* Defaults to true in vscode and to false in monaco-editor.
*/
folding?: boolean;
/**
* Enable to highlight matching brackets.
* Defaults to true.
*/
highlightMatchingBrackets?: boolean;
/**
* Enable rendering of whitespace.
* Defaults to none.
......@@ -913,6 +918,7 @@ export class EditorContribOptions {
readonly selectionHighlight: boolean;
readonly codeLens: boolean;
readonly folding: boolean;
readonly highlightMatchingBrackets: boolean;
/**
* @internal
......@@ -939,6 +945,7 @@ export class EditorContribOptions {
selectionHighlight: boolean;
codeLens: boolean;
folding: boolean;
highlightMatchingBrackets: boolean;
}) {
this.selectionClipboard = Boolean(source.selectionClipboard);
this.hover = Boolean(source.hover);
......@@ -961,6 +968,7 @@ export class EditorContribOptions {
this.selectionHighlight = Boolean(source.selectionHighlight);
this.codeLens = Boolean(source.codeLens);
this.folding = Boolean(source.folding);
this.highlightMatchingBrackets = Boolean(source.highlightMatchingBrackets);
}
/**
......@@ -989,6 +997,7 @@ export class EditorContribOptions {
&& this.selectionHighlight === other.selectionHighlight
&& this.codeLens === other.codeLens
&& this.folding === other.folding
&& this.highlightMatchingBrackets === other.highlightMatchingBrackets
);
}
......
......@@ -13,6 +13,7 @@ import { Position } from 'vs/editor/common/core/position';
import { RunOnceScheduler } from 'vs/base/common/async';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { editorAction, commonEditorContribution, ServicesAccessor, EditorAction } from 'vs/editor/common/editorCommonExtensions';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import EditorContextKeys = editorCommon.EditorContextKeys;
......@@ -67,7 +68,10 @@ export class BracketMatchingController extends Disposable implements editorCommo
private _decorations: string[];
private _updateBracketsSoon: RunOnceScheduler;
constructor(editor: editorCommon.ICommonCodeEditor) {
constructor(
editor: editorCommon.ICommonCodeEditor,
@IConfigurationService private configurationService: IConfigurationService
) {
super();
this._editor = editor;
this._lastBracketsData = [];
......@@ -125,7 +129,7 @@ export class BracketMatchingController extends Disposable implements editorCommo
let newDecorations: editorCommon.IModelDeltaDecoration[] = [], newDecorationsLen = 0;
for (let i = 0, len = this._lastBracketsData.length; i < len; i++) {
let brackets = this._lastBracketsData[i].brackets;
if (brackets) {
if (this.configurationService.lookup<boolean>('editor.highlightMatchingBrackets').value && brackets) {
newDecorations[newDecorationsLen++] = { range: brackets[0], options: BracketMatchingController._DECORATION_OPTIONS };
newDecorations[newDecorationsLen++] = { range: brackets[1], options: BracketMatchingController._DECORATION_OPTIONS };
}
......
......@@ -1381,6 +1381,11 @@ declare module monaco.editor {
* Defaults to true in vscode and to false in monaco-editor.
*/
folding?: boolean;
/**
* Enable to highlight matching brackets
* Defaults to true
*/
highlightMatchingBrackets?: boolean;
/**
* Enable rendering of whitespace.
* Defaults to none.
......@@ -1563,6 +1568,7 @@ declare module monaco.editor {
readonly selectionHighlight: boolean;
readonly codeLens: boolean;
readonly folding: boolean;
readonly highlightMatchingBrackets: boolean;
}
/**
......
......@@ -258,6 +258,7 @@ const configurationValueWhitelist = [
'editor.hideCursorInOverviewRuler',
'editor.trimAutoWhitespace',
'editor.folding',
'editor.highlightMatchingBrackets',
'workbench.editor.enablePreviewFromQuickOpen',
'php.builtInCompletions.enable',
'php.validate.enable',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册