mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Updating keybindings (#1839)
* Changing key combos, and behavior for starting/stopping * Updating keybindings * Fixing mac keybindings * Clear data when starting profiler from keyboard shortcut
This commit is contained in:
committed by
GitHub
parent
1f3e59c9f9
commit
6b618fb121
@@ -55,13 +55,17 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|||||||
id: 'profiler.newProfiler',
|
id: 'profiler.newProfiler',
|
||||||
weight: KeybindingsRegistry.WEIGHT.builtinExtension(),
|
weight: KeybindingsRegistry.WEIGHT.builtinExtension(),
|
||||||
when: undefined,
|
when: undefined,
|
||||||
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_P,
|
primary: KeyMod.Alt | KeyCode.KEY_P,
|
||||||
mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_P },
|
mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.KEY_P },
|
||||||
handler: CommandsRegistry.getCommand('profiler.newProfiler').handler
|
handler: CommandsRegistry.getCommand('profiler.newProfiler').handler
|
||||||
});
|
});
|
||||||
|
|
||||||
CommandsRegistry.registerCommand({
|
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||||
id: 'profiler.start',
|
id: 'profiler.toggleStartStop',
|
||||||
|
weight: KeybindingsRegistry.WEIGHT.editorContrib(),
|
||||||
|
when: undefined,
|
||||||
|
primary: KeyMod.Alt | KeyCode.KEY_S,
|
||||||
|
mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.KEY_S },
|
||||||
handler: (accessor: ServicesAccessor) => {
|
handler: (accessor: ServicesAccessor) => {
|
||||||
let profilerService: IProfilerService = accessor.get(IProfilerService);
|
let profilerService: IProfilerService = accessor.get(IProfilerService);
|
||||||
let editorService: IWorkbenchEditorService = accessor.get(IWorkbenchEditorService);
|
let editorService: IWorkbenchEditorService = accessor.get(IWorkbenchEditorService);
|
||||||
@@ -69,22 +73,13 @@ CommandsRegistry.registerCommand({
|
|||||||
let activeEditor = editorService.getActiveEditor();
|
let activeEditor = editorService.getActiveEditor();
|
||||||
if (activeEditor instanceof ProfilerEditor) {
|
if (activeEditor instanceof ProfilerEditor) {
|
||||||
let profilerInput = activeEditor.input;
|
let profilerInput = activeEditor.input;
|
||||||
return profilerService.startSession(profilerInput.id);
|
if (profilerInput.state.isRunning){
|
||||||
}
|
return profilerService.stopSession(profilerInput.id);
|
||||||
return TPromise.as(false);
|
} else {
|
||||||
}
|
// clear data when profiler is started
|
||||||
});
|
profilerInput.data.clear();
|
||||||
|
return profilerService.startSession(profilerInput.id);
|
||||||
CommandsRegistry.registerCommand({
|
}
|
||||||
id: 'profiler.stop',
|
|
||||||
handler: (accessor: ServicesAccessor) => {
|
|
||||||
let profilerService: IProfilerService = accessor.get(IProfilerService);
|
|
||||||
let editorService: IWorkbenchEditorService = accessor.get(IWorkbenchEditorService);
|
|
||||||
|
|
||||||
let activeEditor = editorService.getActiveEditor();
|
|
||||||
if (activeEditor instanceof ProfilerEditor) {
|
|
||||||
let profilerInput = activeEditor.input;
|
|
||||||
return profilerService.stopSession(profilerInput.id);
|
|
||||||
}
|
}
|
||||||
return TPromise.as(false);
|
return TPromise.as(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user