Merge from vscode 2b0b9136329c181a9e381463a1f7dc3a2d105a34 (#4880)

This commit is contained in:
Karl Burtram
2019-04-05 10:09:18 -07:00
committed by GitHub
parent 9bd7e30d18
commit cb5bcf2248
433 changed files with 8915 additions and 8361 deletions

View File

@@ -23,6 +23,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { editorWidgetBackground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
import { ScrollType } from 'vs/editor/common/editorCommon';
import { SearchWidget, SearchOptions } from 'vs/workbench/contrib/preferences/browser/preferencesWidgets';
import { withNullAsUndefined } from 'vs/base/common/types';
export interface KeybindingsSearchOptions extends SearchOptions {
recordEnter?: boolean;
@@ -257,7 +258,7 @@ export class DefineKeybindingWidget extends Widget {
this._chordPart = chordPart;
dom.clearNode(this._outputNode);
dom.clearNode(this._showExistingKeybindingsNode);
new KeybindingLabel(this._outputNode, OS).set(this._firstPart);
new KeybindingLabel(this._outputNode, OS).set(withNullAsUndefined(this._firstPart));
if (this._chordPart) {
this._outputNode.appendChild(document.createTextNode(nls.localize('defineKeybinding.chordsTo', "chord to")));
new KeybindingLabel(this._outputNode, OS).set(this._chordPart);

View File

@@ -330,6 +330,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this._register(this.searchWidget.onDidChange(searchValue => {
clearInputAction.enabled = !!searchValue;
this.delayedFiltering.trigger(() => this.filterKeybindings());
this.updateSearchOptions();
}));
this._register(this.searchWidget.onEscape(() => this.recordKeysAction.checked = false));
@@ -344,6 +345,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
if (e.checked !== undefined) {
this.renderKeybindingsEntries(false);
}
this.updateSearchOptions();
}));
const recordKeysActionKeybinding = this.keybindingsService.lookupKeybinding(KEYBINDINGS_EDITOR_COMMAND_RECORD_SEARCH_KEYS);
@@ -364,6 +366,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this.searchWidget.stopRecordingKeys();
this.searchWidget.focus();
}
this.updateSearchOptions();
}
}));
@@ -383,6 +386,17 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this.actionBar.push([this.recordKeysAction, this.sortByPrecedenceAction, clearInputAction], { label: false, icon: true });
}
private updateSearchOptions(): void {
const keybindingsEditorInput = this.input as KeybindingsEditorInput;
if (keybindingsEditorInput) {
keybindingsEditorInput.searchOptions = {
searchValue: this.searchWidget.getValue(),
recordKeybindings: !!this.recordKeysAction.checked,
sortByPrecedence: !!this.sortByPrecedenceAction.checked
};
}
}
private createRecordingBadge(container: HTMLElement): HTMLElement {
const recordingBadge = DOM.append(container, DOM.$('.recording-badge.disabled'));
recordingBadge.textContent = localize('recording', "Recording Keys");
@@ -482,6 +496,13 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}, {});
await this.keybindingsEditorModel.resolve(editorActionsLabels);
this.renderKeybindingsEntries(false, preserveFocus);
if (input.searchOptions) {
this.recordKeysAction.checked = input.searchOptions.recordKeybindings;
this.sortByPrecedenceAction.checked = input.searchOptions.sortByPrecedence;
this.searchWidget.setValue(input.searchOptions.searchValue);
} else {
this.updateSearchOptions();
}
}
}
@@ -876,7 +897,7 @@ class ActionsColumn extends Column {
}
dispose(): void {
this.actionBar = dispose(this.actionBar);
dispose(this.actionBar);
}
}

View File

@@ -170,7 +170,7 @@ export class PreferencesEditor extends BaseEditor {
this.sideBySidePreferencesWidget.layout(new DOM.Dimension(dimension.width, dimension.height - headerHeight));
}
getControl(): IEditorControl | null {
getControl(): IEditorControl | undefined {
return this.sideBySidePreferencesWidget.getControl();
}
@@ -890,8 +890,8 @@ class SideBySidePreferencesWidget extends Widget {
}
}
getControl(): IEditorControl | null {
return this.editablePreferencesEditor ? this.editablePreferencesEditor.getControl() : null;
getControl(): IEditorControl | undefined {
return this.editablePreferencesEditor ? this.editablePreferencesEditor.getControl() : undefined;
}
clearInput(): void {