diff --git a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts index 6d8f7a7cfc9..685ff45efaa 100644 --- a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts +++ b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts @@ -281,6 +281,14 @@ export class BracketMatchingController extends Disposable implements editorCommo return; } + const selections = this._editor.getSelections(); + if (selections.length > 100) { + // no bracket matching for high numbers of selections + this._lastBracketsData = []; + this._lastVersionId = 0; + return; + } + const model = this._editor.getModel(); const versionId = model.getVersionId(); let previousData: BracketsData[] = []; @@ -289,8 +297,6 @@ export class BracketMatchingController extends Disposable implements editorCommo previousData = this._lastBracketsData; } - const selections = this._editor.getSelections(); - let positions: Position[] = [], positionsLen = 0; for (let i = 0, len = selections.length; i < len; i++) { let selection = selections[i]; @@ -319,6 +325,9 @@ export class BracketMatchingController extends Disposable implements editorCommo newData[newDataLen++] = previousData[previousIndex]; } else { let brackets = model.matchBracket(position); + if (!brackets) { + brackets = model.findEnclosingBrackets(position); + } newData[newDataLen++] = new BracketsData(position, brackets); } } diff --git a/src/vs/workbench/browser/parts/editor/editorStatus.ts b/src/vs/workbench/browser/parts/editor/editorStatus.ts index edb286ae31b..2bac0c42249 100644 --- a/src/vs/workbench/browser/parts/editor/editorStatus.ts +++ b/src/vs/workbench/browser/parts/editor/editorStatus.ts @@ -363,7 +363,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution { return { id: a.id, label: a.label, - detail: Language.isDefaultVariant() ? undefined : a.alias, + detail: (Language.isDefaultVariant() || a.label === a.alias) ? undefined : a.alias, run: () => { activeTextEditorWidget.focus(); a.run(); @@ -1133,14 +1133,19 @@ export class ChangeEncodingAction extends Action { return this.quickInputService.pick([{ label: nls.localize('noFileEditor', "No file active at this time") }]); } - let saveWithEncodingPick: IQuickPickItem; - let reopenWithEncodingPick: IQuickPickItem; - if (Language.isDefaultVariant()) { - saveWithEncodingPick = { label: nls.localize('saveWithEncoding', "Save with Encoding") }; - reopenWithEncodingPick = { label: nls.localize('reopenWithEncoding', "Reopen with Encoding") }; - } else { - saveWithEncodingPick = { label: nls.localize('saveWithEncoding', "Save with Encoding"), detail: 'Save with Encoding', }; - reopenWithEncodingPick = { label: nls.localize('reopenWithEncoding', "Reopen with Encoding"), detail: 'Reopen with Encoding' }; + const saveWithEncodingPick: IQuickPickItem = { label: nls.localize('saveWithEncoding', "Save with Encoding") }; + const reopenWithEncodingPick: IQuickPickItem = { label: nls.localize('reopenWithEncoding', "Reopen with Encoding") }; + + if (!Language.isDefaultVariant()) { + const saveWithEncodingAlias = 'Save with Encoding'; + if (saveWithEncodingAlias !== saveWithEncodingPick.label) { + saveWithEncodingPick.detail = saveWithEncodingAlias; + } + + const reopenWithEncodingAlias = 'Reopen with Encoding'; + if (reopenWithEncodingAlias !== reopenWithEncodingPick.label) { + reopenWithEncodingPick.detail = reopenWithEncodingAlias; + } } let action: IQuickPickItem;