1- import type { DevToolsClientCommand , DevToolsCommandEntry , DevToolsCommandKeybinding , DevToolsServerCommandEntry , WhenContext } from '@vitejs/devtools-kit'
1+ import type { DevToolsClientCommand , DevToolsCommandEntry , DevToolsCommandKeybinding , DevToolsDocksUserSettings , DevToolsServerCommandEntry , WhenContext } from '@vitejs/devtools-kit'
22import type { CommandsContext , DevToolsRpcClient } from '@vitejs/devtools-kit/client'
3+ import type { SharedState } from '@vitejs/devtools-kit/utils/shared-state'
34import type { ShallowRef } from 'vue'
45import { evaluateWhen } from '@vitejs/devtools-kit/utils/when'
56import { computed , markRaw , reactive , ref } from 'vue'
@@ -13,6 +14,7 @@ const commandsContextByRpc = new WeakMap<DevToolsRpcClient, CommandsContext>()
1314export async function createCommandsContext (
1415 clientType : 'embedded' | 'standalone' ,
1516 rpc : DevToolsRpcClient ,
17+ settingsState : SharedState < DevToolsDocksUserSettings > ,
1618 whenContextProvider ?: ( ) => WhenContext ,
1719) : Promise < CommandsContext > {
1820 if ( commandsContextByRpc . has ( rpc ) ) {
@@ -26,9 +28,9 @@ export async function createCommandsContext(
2628 // Client commands (local registry)
2729 const clientCommands = reactive ( new Map < string , DevToolsClientCommand > ( ) )
2830
29- // Shortcut overrides
30- const shortcutOverridesState = await rpc . sharedState . get ( 'devtoolskit:internal:command-shortcuts' , { initialValue : { } } )
31- const shortcutOverrides = sharedStateToRef ( shortcutOverridesState )
31+ // Shortcut overrides from user settings
32+ const settings = sharedStateToRef ( settingsState )
33+ const shortcutOverrides = computed ( ( ) => settings . value . commandShortcuts ?? { } )
3234
3335 const paletteOpen = ref ( false )
3436
@@ -135,7 +137,7 @@ export async function createCommandsContext(
135137 register,
136138 execute,
137139 getKeybindings,
138- shortcutOverrides : markRaw ( shortcutOverridesState ) ,
140+ settings : markRaw ( settingsState ) ,
139141 paletteOpen,
140142 } )
141143
0 commit comments