Merge from vscode a416c77e56ef0314ae00633faa04878151610de8 (#8600)

* Merge from vscode a416c77e56ef0314ae00633faa04878151610de8

* distro

* fix tests

* fix tests
This commit is contained in:
Anthony Dresser
2019-12-07 17:19:16 -08:00
committed by GitHub
parent a7ff238653
commit d614116b63
155 changed files with 1982 additions and 1599 deletions

View File

@@ -116,7 +116,7 @@ export class BracketMatchingController extends Disposable implements editorCommo
private _lastVersionId: number;
private _decorations: string[];
private readonly _updateBracketsSoon: RunOnceScheduler;
private _matchBrackets: boolean;
private _matchBrackets: 'never' | 'near' | 'always';
constructor(
editor: ICodeEditor
@@ -132,7 +132,7 @@ export class BracketMatchingController extends Disposable implements editorCommo
this._updateBracketsSoon.schedule();
this._register(editor.onDidChangeCursorPosition((e) => {
if (!this._matchBrackets) {
if (this._matchBrackets === 'never') {
// Early exit if nothing needs to be done!
// Leave some form of early exit check here if you wish to continue being a cursor position change listener ;)
return;
@@ -153,12 +153,13 @@ export class BracketMatchingController extends Disposable implements editorCommo
this._updateBracketsSoon.schedule();
}));
this._register(editor.onDidChangeConfiguration((e) => {
this._matchBrackets = this._editor.getOption(EditorOption.matchBrackets);
if (!this._matchBrackets && this._decorations.length > 0) {
// Remove existing decorations if bracket matching is off
if (e.hasChanged(EditorOption.matchBrackets)) {
this._matchBrackets = this._editor.getOption(EditorOption.matchBrackets);
this._decorations = this._editor.deltaDecorations(this._decorations, []);
this._lastBracketsData = [];
this._lastVersionId = 0;
this._updateBracketsSoon.schedule();
}
this._updateBracketsSoon.schedule();
}));
}
@@ -262,7 +263,7 @@ export class BracketMatchingController extends Disposable implements editorCommo
});
private _updateBrackets(): void {
if (!this._matchBrackets) {
if (this._matchBrackets === 'never') {
return;
}
this._recomputeBrackets();
@@ -332,8 +333,8 @@ export class BracketMatchingController extends Disposable implements editorCommo
} else {
let brackets = model.matchBracket(position);
let options = BracketMatchingController._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;
if (!brackets) {
brackets = model.findEnclosingBrackets(position);
if (!brackets && this._matchBrackets === 'always') {
brackets = model.findEnclosingBrackets(position, 20 /* give at most 20ms to compute */);
options = BracketMatchingController._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER;
}
newData[newDataLen++] = new BracketsData(position, brackets, options);

View File

@@ -148,19 +148,29 @@ export class ContextMenuController implements IEditorContribution {
// translate them into other actions
for (let group of groups) {
const [, actions] = group;
let addedItems = 0;
for (const action of actions) {
if (action instanceof SubmenuItemAction) {
const subActions = this._getMenuActions(model, action.item.submenu);
if (subActions.length > 0) {
result.push(new ContextSubMenu(action.label, subActions));
addedItems++;
}
} else {
result.push(action);
addedItems++;
}
}
result.push(new Separator());
if (addedItems) {
result.push(new Separator());
}
}
result.pop(); // remove last separator
if (result.length) {
result.pop(); // remove last separator
}
return result;
}

View File

@@ -63,7 +63,7 @@ const PART_WIDTH = 275;
const FIND_INPUT_AREA_WIDTH = PART_WIDTH - 54;
let MAX_MATCHES_COUNT_WIDTH = 69;
let FIND_ALL_CONTROLS_WIDTH = 17/** Find Input margin-left */ + (MAX_MATCHES_COUNT_WIDTH + 3 + 1) /** Match Results */ + 23 /** Button */ * 4 + 2/** sash */;
// let FIND_ALL_CONTROLS_WIDTH = 17/** Find Input margin-left */ + (MAX_MATCHES_COUNT_WIDTH + 3 + 1) /** Match Results */ + 23 /** Button */ * 4 + 2/** sash */;
const FIND_INPUT_AREA_HEIGHT = 33; // The height of Find Widget when Replace Input is not visible.
const ctrlEnterReplaceAllWarningPromptedKey = 'ctrlEnterReplaceAll.windows.donotask';
@@ -706,10 +706,12 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
if (this._resized) {
this._findInput.inputBox.layout();
let findInputWidth = this._findInput.inputBox.width;
let findInputWidth = this._findInput.inputBox.element.clientWidth;
if (findInputWidth > 0) {
this._replaceInput.width = findInputWidth;
}
} else if (this._isReplaceVisible) {
this._replaceInput.width = dom.getTotalWidth(this._findInput.domNode);
}
}
@@ -1159,13 +1161,11 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
return;
}
const inputBoxWidth = width - FIND_ALL_CONTROLS_WIDTH;
const maxWidth = parseFloat(dom.getComputedStyle(this._domNode).maxWidth!) || 0;
if (width > maxWidth) {
return;
}
this._domNode.style.width = `${width}px`;
this._findInput.inputBox.width = inputBoxWidth;
if (this._isReplaceVisible) {
this._replaceInput.width = dom.getTotalWidth(this._findInput.domNode);
}
@@ -1197,10 +1197,8 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
*/
}
const inputBoxWidth = width - FIND_ALL_CONTROLS_WIDTH;
this._domNode.style.width = `${width}px`;
this._findInput.inputBox.width = inputBoxWidth;
if (this._isReplaceVisible) {
this._replaceInput.width = dom.getTotalWidth(this._findInput.domNode);
}

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { ReferencesModel, OneReference } from 'vs/editor/contrib/gotoSymbol/referencesModel';
import { RawContextKey, IContextKeyService, IContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { RawContextKey, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { createDecorator, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { KeybindingWeight, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
@@ -155,10 +155,7 @@ registerEditorCommand(new class extends EditorCommand {
constructor() {
super({
id: 'editor.gotoNextSymbolFromResult',
precondition: ContextKeyExpr.and(
ctxHasSymbols,
ContextKeyExpr.equals('config.editor.gotoLocation.multiple', 'goto')
),
precondition: ctxHasSymbols,
kbOpts: {
weight: KeybindingWeight.EditorContrib,
primary: KeyCode.F12

View File

@@ -34,6 +34,7 @@
.monaco-editor .parameter-hints-widget .body {
display: flex;
flex-direction: column;
min-height: 100%;
}
.monaco-editor .parameter-hints-widget .signature {
@@ -72,6 +73,7 @@
.monaco-editor .parameter-hints-widget.multiple .controls {
display: flex;
padding: 0 2px;
}
.monaco-editor .parameter-hints-widget.multiple .button {
@@ -95,6 +97,7 @@
height: 12px;
line-height: 12px;
opacity: 0.5;
font-family: var(--monaco-monospace-font);
}
.monaco-editor .parameter-hints-widget .signature .parameter.active {