mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 17:23:21 -05:00
Add keyboard shortcuts for focus on current query and go to next output query tab (#1153)
* add go to next output query tab shotcut * add a new keyboard shortcut for focus on current query * minor change
This commit is contained in:
@@ -25,7 +25,7 @@ import { EditDataEditor } from 'sql/parts/editData/editor/editDataEditor';
|
||||
import { EditDataInput } from 'sql/parts/editData/common/editDataInput';
|
||||
import {
|
||||
RunQueryKeyboardAction, RunCurrentQueryKeyboardAction, CancelQueryKeyboardAction, RefreshIntellisenseKeyboardAction, ToggleQueryResultsKeyboardAction,
|
||||
RunQueryShortcutAction, RunCurrentQueryWithActualPlanKeyboardAction
|
||||
RunQueryShortcutAction, RunCurrentQueryWithActualPlanKeyboardAction, FocusOnCurrentQueryKeyboardAction
|
||||
} from 'sql/parts/query/execution/keyboardQueryActions';
|
||||
import * as gridActions from 'sql/parts/grid/views/gridActions';
|
||||
import * as gridCommands from 'sql/parts/grid/views/gridCommands';
|
||||
@@ -132,6 +132,16 @@ actionRegistry.registerWorkbenchAction(
|
||||
RefreshIntellisenseKeyboardAction.LABEL
|
||||
);
|
||||
|
||||
actionRegistry.registerWorkbenchAction(
|
||||
new SyncActionDescriptor(
|
||||
FocusOnCurrentQueryKeyboardAction,
|
||||
FocusOnCurrentQueryKeyboardAction.ID,
|
||||
FocusOnCurrentQueryKeyboardAction.LABEL,
|
||||
{ primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_Q }
|
||||
),
|
||||
FocusOnCurrentQueryKeyboardAction.LABEL
|
||||
);
|
||||
|
||||
// Grid actions
|
||||
|
||||
actionRegistry.registerWorkbenchAction(
|
||||
@@ -217,6 +227,14 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
handler: gridCommands.toggleMessagePane
|
||||
});
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.GOTONEXTQUERYOUTPUTTAB_ID,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(gridCommandsWeightBonus),
|
||||
when: QueryEditorVisibleCondition,
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_P,
|
||||
handler: gridCommands.goToNextQueryOutputTab
|
||||
});
|
||||
|
||||
// Intellisense and other configuration options
|
||||
let registryProperties = {
|
||||
'sql.messagesDefaultOpen': {
|
||||
|
||||
@@ -51,6 +51,34 @@ function escapeSqlString(input: string, escapeChar: string) {
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Locates the active editor and call focus() on the editor if it is a QueryEditor.
|
||||
*/
|
||||
export class FocusOnCurrentQueryKeyboardAction extends Action {
|
||||
|
||||
public static ID = 'focusOnCurrentQueryKeyboardAction';
|
||||
public static LABEL = nls.localize('focusOnCurrentQueryKeyboardAction', 'Focus on Current Query');
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService
|
||||
) {
|
||||
super(id, label);
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
let editor = this._editorService.getActiveEditor();
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
queryEditor.focus();
|
||||
}
|
||||
return TPromise.as(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Locates the active editor and calls runQuery() on the editor if it is a QueryEditor.
|
||||
*/
|
||||
|
||||
@@ -102,6 +102,11 @@ export class QueryOutputComponent implements OnInit, OnDestroy {
|
||||
this._cd.detectChanges();
|
||||
}
|
||||
})));
|
||||
|
||||
this._disposables.push(toDisposableSubscription(this.queryComponent.goToNextQueryOutputTabRequested.subscribe(() => {
|
||||
let activeTab = this._panel.getActiveTab;
|
||||
this._panel.selectOnNextTab();
|
||||
})));
|
||||
}
|
||||
|
||||
public ngOnDestroy(): void {
|
||||
|
||||
Reference in New Issue
Block a user