提交 8a93c778 编写于 作者: A Alex Dima

Rename editor.highlightMatchingBrackets to editor.matchBrackets

上级 46c9a3cd
......@@ -308,7 +308,7 @@ class InternalEditorOptionsHelper {
selectionHighlight: toBoolean(opts.selectionHighlight),
codeLens: opts.referenceInfos && opts.codeLens,
folding: toBoolean(opts.folding),
highlightMatchingBrackets: toBoolean(opts.highlightMatchingBrackets),
matchBrackets: toBoolean(opts.matchBrackets),
});
return new editorCommon.InternalEditorOptions({
......@@ -823,10 +823,10 @@ const editorConfiguration: IConfigurationNode = {
'default': DefaultConfig.editor.folding,
'description': nls.localize('folding', "Controls whether the editor has code folding enabled")
},
'editor.highlightMatchingBrackets': {
'editor.matchBrackets': {
'type': 'boolean',
'default': true,
'description': nls.localize('highlightMatchingBrackets', "Highlight matching brackets when one of them is selected.")
'default': DefaultConfig.editor.matchBrackets,
'description': nls.localize('matchBrackets', "Highlight matching brackets when one of them is selected.")
},
'editor.glyphMargin': {
'type': 'boolean',
......
......@@ -106,7 +106,7 @@ class ConfigClass implements IConfiguration {
renderIndentGuides: false,
renderLineHighlight: 'line',
useTabStops: true,
highlightMatchingBrackets: true,
matchBrackets: true,
fontFamily: (
platform.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY)
......
......@@ -481,10 +481,10 @@ export interface IEditorOptions {
*/
folding?: boolean;
/**
* Enable to highlight matching brackets.
* Enable highlighting of matching brackets.
* Defaults to true.
*/
highlightMatchingBrackets?: boolean;
matchBrackets?: boolean;
/**
* Enable rendering of whitespace.
* Defaults to none.
......@@ -971,7 +971,7 @@ export class EditorContribOptions {
readonly selectionHighlight: boolean;
readonly codeLens: boolean;
readonly folding: boolean;
readonly highlightMatchingBrackets: boolean;
readonly matchBrackets: boolean;
/**
* @internal
......@@ -998,7 +998,7 @@ export class EditorContribOptions {
selectionHighlight: boolean;
codeLens: boolean;
folding: boolean;
highlightMatchingBrackets: boolean;
matchBrackets: boolean;
}) {
this.selectionClipboard = Boolean(source.selectionClipboard);
this.hover = Boolean(source.hover);
......@@ -1021,7 +1021,7 @@ export class EditorContribOptions {
this.selectionHighlight = Boolean(source.selectionHighlight);
this.codeLens = Boolean(source.codeLens);
this.folding = Boolean(source.folding);
this.highlightMatchingBrackets = Boolean(source.highlightMatchingBrackets);
this.matchBrackets = Boolean(source.matchBrackets);
}
/**
......@@ -1050,7 +1050,7 @@ export class EditorContribOptions {
&& this.selectionHighlight === other.selectionHighlight
&& this.codeLens === other.codeLens
&& this.folding === other.folding
&& this.highlightMatchingBrackets === other.highlightMatchingBrackets
&& this.matchBrackets === other.matchBrackets
);
}
......
......@@ -67,6 +67,7 @@ export class BracketMatchingController extends Disposable implements editorCommo
private _lastVersionId: number;
private _decorations: string[];
private _updateBracketsSoon: RunOnceScheduler;
private _matchBrackets: boolean;
constructor(
editor: editorCommon.ICommonCodeEditor,
......@@ -78,10 +79,19 @@ export class BracketMatchingController extends Disposable implements editorCommo
this._lastVersionId = 0;
this._decorations = [];
this._updateBracketsSoon = this._register(new RunOnceScheduler(() => this._updateBrackets(), 50));
this._matchBrackets = this._editor.getConfiguration().contribInfo.matchBrackets;
this._updateBracketsSoon.schedule();
this._register(editor.onDidChangeCursorPosition((e) => this._updateBracketsSoon.schedule()));
this._register(editor.onDidChangeModel((e) => { this._decorations = []; this._updateBracketsSoon.schedule(); }));
this._register(editor.onDidChangeConfiguration((e) => {
this._matchBrackets = this._editor.getConfiguration().contribInfo.matchBrackets;
if (!this._matchBrackets && this._decorations.length > 0) {
// Remove existing decorations if bracket matching is off
this._decorations = this._editor.deltaDecorations(this._decorations, []);
}
this._updateBracketsSoon.schedule();
}));
}
public getId(): string {
......@@ -124,12 +134,15 @@ export class BracketMatchingController extends Disposable implements editorCommo
};
private _updateBrackets(): void {
if (!this._matchBrackets) {
return;
}
this._recomputeBrackets();
let newDecorations: editorCommon.IModelDeltaDecoration[] = [], newDecorationsLen = 0;
for (let i = 0, len = this._lastBracketsData.length; i < len; i++) {
let brackets = this._lastBracketsData[i].brackets;
if (this.configurationService.lookup<boolean>('editor.highlightMatchingBrackets').value && brackets) {
if (brackets) {
newDecorations[newDecorationsLen++] = { range: brackets[0], options: BracketMatchingController._DECORATION_OPTIONS };
newDecorations[newDecorationsLen++] = { range: brackets[1], options: BracketMatchingController._DECORATION_OPTIONS };
}
......
......@@ -1397,10 +1397,10 @@ declare module monaco.editor {
*/
folding?: boolean;
/**
* Enable to highlight matching brackets.
* Enable highlighting of matching brackets.
* Defaults to true.
*/
highlightMatchingBrackets?: boolean;
matchBrackets?: boolean;
/**
* Enable rendering of whitespace.
* Defaults to none.
......@@ -1590,7 +1590,7 @@ declare module monaco.editor {
readonly selectionHighlight: boolean;
readonly codeLens: boolean;
readonly folding: boolean;
readonly highlightMatchingBrackets: boolean;
readonly matchBrackets: boolean;
}
/**
......
......@@ -250,7 +250,7 @@ const configurationValueWhitelist = [
'editor.hideCursorInOverviewRuler',
'editor.trimAutoWhitespace',
'editor.folding',
'editor.highlightMatchingBrackets',
'editor.matchBrackets',
'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.
先完成此消息的编辑!
想要评论请 注册