Add profiling shortcuts to GUI2 (#8406)

- Closes #8404

# Important Notes
- All relevant documentation has already been updated in #8358.
- I've tested that the keyboard shortcuts send appropriate messages over the LS connection, and have confirmed that a non-error response is received, but I'm not sure that the profiling actually works.
- There seem to be no entries in `~/.enso/`, nor in `~/enso/`
This commit is contained in:
somebody1234 2023-11-29 00:44:46 +10:00 committed by GitHub
parent a38680adf4
commit 93a4937cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

View File

@ -380,6 +380,16 @@ export class LanguageServer extends ObservableV2<Notifications> {
return this.request('runtime/getComponentGroups', {})
}
/** [Documentation](https://github.com/enso-org/enso/blob/develop/docs/language-server/protocol-language-server.md#profilingstart) */
profilingStart(memorySnapshot?: boolean): Promise<void> {
return this.request('profiling/start', { memorySnapshot })
}
/** [Documentation](https://github.com/enso-org/enso/blob/develop/docs/language-server/protocol-language-server.md#profilingstop) */
profilingStop(): Promise<void> {
return this.request('profiling/stop', {})
}
/** A helper function to subscribe to file updates.
* Please use `ls.on('file/event')` directly if the initial `'Added'` notifications are not
* needed. */

View File

@ -30,6 +30,8 @@ export const graphBindings = defineKeybinds('graph-editor', {
deselectAll: ['Escape', 'PointerMain'],
copyNode: ['Mod+C'],
pasteNode: ['Mod+V'],
startProfiling: ['Mod+Alt+,'],
stopProfiling: ['Mod+Alt+.'],
})
export const selectionMouseBindings = defineKeybinds('selection', {

View File

@ -132,6 +132,12 @@ const graphBindingsHandler = graphBindings.handler({
redo() {
projectStore.module?.undoManager.redo()
},
startProfiling() {
projectStore.lsRpcConnection.then((ls) => ls.profilingStart(true))
},
stopProfiling() {
projectStore.lsRpcConnection.then((ls) => ls.profilingStop())
},
openComponentBrowser() {
if (keyboardBusy()) return false
if (graphNavigator.sceneMousePos != null && !componentBrowserVisible.value) {