mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 09:35:37 -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',
|
||||
weight: KeybindingsRegistry.WEIGHT.builtinExtension(),
|
||||
when: undefined,
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_P,
|
||||
mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_P },
|
||||
primary: KeyMod.Alt | KeyCode.KEY_P,
|
||||
mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.KEY_P },
|
||||
handler: CommandsRegistry.getCommand('profiler.newProfiler').handler
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: 'profiler.start',
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
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) => {
|
||||
let profilerService: IProfilerService = accessor.get(IProfilerService);
|
||||
let editorService: IWorkbenchEditorService = accessor.get(IWorkbenchEditorService);
|
||||
@@ -69,23 +73,14 @@ CommandsRegistry.registerCommand({
|
||||
let activeEditor = editorService.getActiveEditor();
|
||||
if (activeEditor instanceof ProfilerEditor) {
|
||||
let profilerInput = activeEditor.input;
|
||||
return profilerService.startSession(profilerInput.id);
|
||||
if (profilerInput.state.isRunning){
|
||||
return profilerService.stopSession(profilerInput.id);
|
||||
} else {
|
||||
// clear data when profiler is started
|
||||
profilerInput.data.clear();
|
||||
return profilerService.startSession(profilerInput.id);
|
||||
}
|
||||
}
|
||||
return TPromise.as(false);
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user