mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 01:00:29 -04:00
VSCode merge (#4610)
* Merge from vscode e388c734f30757875976c7e326d6cfeee77710de * fix yarn lcoks * remove small issue
This commit is contained in:
@@ -76,7 +76,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
|
||||
private columnItems: ColumnItem[] = [];
|
||||
private keybindingsListContainer: HTMLElement;
|
||||
private unAssignedKeybindingItemToRevealAndFocus: IKeybindingItemEntry;
|
||||
private unAssignedKeybindingItemToRevealAndFocus: IKeybindingItemEntry | null;
|
||||
private listEntries: IListEntry[];
|
||||
private keybindingsList: List<IListEntry>;
|
||||
|
||||
@@ -109,7 +109,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
) {
|
||||
super(KeybindingsEditor.ID, telemetryService, themeService, storageService);
|
||||
this.delayedFiltering = new Delayer<void>(300);
|
||||
this._register(keybindingsService.onDidUpdateKeybindings(() => this.render(true, CancellationToken.None)));
|
||||
this._register(keybindingsService.onDidUpdateKeybindings(() => this.render(true)));
|
||||
|
||||
this.keybindingsEditorContextKey = CONTEXT_KEYBINDINGS_EDITOR.bindTo(this.contextKeyService);
|
||||
this.searchFocusContextKey = CONTEXT_KEYBINDINGS_SEARCH_FOCUS.bindTo(this.contextKeyService);
|
||||
@@ -129,7 +129,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
setInput(input: KeybindingsEditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
|
||||
this.keybindingsEditorContextKey.set(true);
|
||||
return super.setInput(input, options, token)
|
||||
.then(() => this.render(!!(options && options.preserveFocus), token));
|
||||
.then(() => this.render(!!(options && options.preserveFocus)));
|
||||
}
|
||||
|
||||
clearInput(): void {
|
||||
@@ -173,7 +173,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
}
|
||||
}
|
||||
|
||||
get activeKeybindingEntry(): IKeybindingItemEntry {
|
||||
get activeKeybindingEntry(): IKeybindingItemEntry | null {
|
||||
const focusedElement = this.keybindingsList.getFocusedElements()[0];
|
||||
return focusedElement && focusedElement.templateId === KEYBINDING_ENTRY_TEMPLATE_ID ? <IKeybindingItemEntry>focusedElement : null;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
this.selectEntry(keybinding);
|
||||
this.reportKeybindingAction(KEYBINDINGS_EDITOR_COMMAND_COPY, keybinding.keybindingItem.command, keybinding.keybindingItem.keybinding);
|
||||
const userFriendlyKeybinding: IUserFriendlyKeybinding = {
|
||||
key: keybinding.keybindingItem.keybinding ? keybinding.keybindingItem.keybinding.getUserSettingsLabel() : '',
|
||||
key: keybinding.keybindingItem.keybinding ? keybinding.keybindingItem.keybinding.getUserSettingsLabel() || '' : '',
|
||||
command: keybinding.keybindingItem.command
|
||||
};
|
||||
if (keybinding.keybindingItem.when) {
|
||||
@@ -454,45 +454,35 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
|
||||
DOM.removeClass(this.keybindingsList.getHTMLElement(), 'focused');
|
||||
this.keybindingFocusContextKey.reset();
|
||||
}));
|
||||
this._register(this.keybindingsList.onMouseDblClick(() => this.defineKeybinding(this.activeKeybindingEntry)));
|
||||
this._register(this.keybindingsList.onMouseDblClick(() => {
|
||||
const activeKeybindingEntry = this.activeKeybindingEntry;
|
||||
if (activeKeybindingEntry) {
|
||||
this.defineKeybinding(activeKeybindingEntry);
|
||||
}
|
||||
}));
|
||||
this._register(this.keybindingsList.onKeyDown(e => {
|
||||
const event = new StandardKeyboardEvent(e);
|
||||
if (event.keyCode === KeyCode.Enter) {
|
||||
const keybindingEntry = this.activeKeybindingEntry;
|
||||
if (keybindingEntry) {
|
||||
this.defineKeybinding(this.activeKeybindingEntry);
|
||||
this.defineKeybinding(keybindingEntry);
|
||||
}
|
||||
e.stopPropagation();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private render(preserveFocus: boolean, token: CancellationToken): Promise<any> {
|
||||
private async render(preserveFocus: boolean): Promise<void> {
|
||||
if (this.input) {
|
||||
return this.input.resolve()
|
||||
.then((keybindingsModel: KeybindingsEditorModel) => {
|
||||
if (token.isCancellationRequested) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
this.keybindingsEditorModel = keybindingsModel;
|
||||
|
||||
const editorActionsLabels: { [id: string]: string; } = EditorExtensionsRegistry.getEditorActions().reduce((editorActions, editorAction) => {
|
||||
editorActions[editorAction.id] = editorAction.label;
|
||||
return editorActions;
|
||||
}, {});
|
||||
|
||||
return this.keybindingsEditorModel.resolve(editorActionsLabels);
|
||||
})
|
||||
.then(() => {
|
||||
if (token.isCancellationRequested) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
this.renderKeybindingsEntries(false, preserveFocus);
|
||||
});
|
||||
const input: KeybindingsEditorInput = this.input as KeybindingsEditorInput;
|
||||
this.keybindingsEditorModel = await input.resolve();
|
||||
const editorActionsLabels: { [id: string]: string; } = EditorExtensionsRegistry.getEditorActions().reduce((editorActions, editorAction) => {
|
||||
editorActions[editorAction.id] = editorAction.label;
|
||||
return editorActions;
|
||||
}, {});
|
||||
await this.keybindingsEditorModel.resolve(editorActionsLabels);
|
||||
this.renderKeybindingsEntries(false, preserveFocus);
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
private filterKeybindings(): void {
|
||||
@@ -1105,7 +1095,7 @@ class WhenColumn extends Column {
|
||||
this.element.title = '';
|
||||
}
|
||||
this.onDidAccept(() => {
|
||||
this.keybindingsEditor.updateKeybinding(keybindingItemEntry, keybindingItemEntry.keybindingItem.keybinding ? keybindingItemEntry.keybindingItem.keybinding.getUserSettingsLabel() : '', this.whenInput.value);
|
||||
this.keybindingsEditor.updateKeybinding(keybindingItemEntry, keybindingItemEntry.keybindingItem.keybinding ? keybindingItemEntry.keybindingItem.keybinding.getUserSettingsLabel() || '' : '', this.whenInput.value);
|
||||
this.keybindingsEditor.selectKeybinding(keybindingItemEntry);
|
||||
}, this, this.disposables);
|
||||
this.onDidReject(() => {
|
||||
|
||||
@@ -45,7 +45,7 @@ export interface ISearchProvider {
|
||||
|
||||
export interface IKeybindingsEditor extends IEditor {
|
||||
|
||||
readonly activeKeybindingEntry: IKeybindingItemEntry;
|
||||
readonly activeKeybindingEntry: IKeybindingItemEntry | null;
|
||||
readonly onDefineWhenExpression: Event<IKeybindingItemEntry>;
|
||||
readonly onLayout: Event<void>;
|
||||
|
||||
|
||||
@@ -227,7 +227,20 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
handler: (accessor, args: any) => {
|
||||
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
|
||||
if (control && control instanceof KeybindingsEditor) {
|
||||
control.defineKeybinding(control.activeKeybindingEntry);
|
||||
control.defineKeybinding(control.activeKeybindingEntry!);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: KEYBINDINGS_EDITOR_COMMAND_DEFINE_WHEN,
|
||||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
when: ContextKeyExpr.and(CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDING_FOCUS),
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_E),
|
||||
handler: (accessor, args: any) => {
|
||||
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
|
||||
if (control && control instanceof KeybindingsEditor && control.activeKeybindingEntry!.keybindingItem.keybinding) {
|
||||
control.defineWhenExpression(control.activeKeybindingEntry!);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -256,7 +269,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
handler: (accessor, args: any) => {
|
||||
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
|
||||
if (control && control instanceof KeybindingsEditor) {
|
||||
control.removeKeybinding(control.activeKeybindingEntry);
|
||||
control.removeKeybinding(control.activeKeybindingEntry!);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -269,7 +282,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
handler: (accessor, args: any) => {
|
||||
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
|
||||
if (control && control instanceof KeybindingsEditor) {
|
||||
control.resetKeybinding(control.activeKeybindingEntry);
|
||||
control.resetKeybinding(control.activeKeybindingEntry!);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -323,7 +336,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
handler: (accessor, args: any) => {
|
||||
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
|
||||
if (control) {
|
||||
control.showSimilarKeybindings(control.activeKeybindingEntry);
|
||||
control.showSimilarKeybindings(control.activeKeybindingEntry!);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -336,7 +349,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
handler: (accessor, args: any) => {
|
||||
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
|
||||
if (control) {
|
||||
control.copyKeybinding(control.activeKeybindingEntry);
|
||||
control.copyKeybinding(control.activeKeybindingEntry!);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -349,7 +362,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
handler: (accessor, args: any) => {
|
||||
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
|
||||
if (control) {
|
||||
control.copyKeybindingCommand(control.activeKeybindingEntry);
|
||||
control.copyKeybindingCommand(control.activeKeybindingEntry!);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user