You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is not a bug report. (please use a different template for reporting a bug)
This issue is not a duplicate of an existing issue. (please use the search to find existing issues)
Description
I have an editor built by Monaco Editor. For certain texts, it returns certain code actions and quick fix.
However, the shortcut Command + . does not work in Mac and Chrome; Ctrl + . does not work in Windows and Chrome either (I use French keyboard). (This is a working sample of quickFix provided by someone else, where shortcuts don't work either.)
Does anyone know what may be the reason?
I then tried to overwrite the shortcuts. I have the following code in index.tsx:
handleEditorDidMount(editor, monaco) {
// I tried to follow `updateKeyBinding` of https://github.com/microsoft/monaco-editor/issues/102#issuecomment-822981429
const id = "editor.action.quickFix"
const newKeyBinding = monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyP
const { handler, when } = CommandsRegistry.getCommand(id) ?? {}
editor._standaloneKeybindingService.addDynamicKeybinding(id, newKeyBinding, handler)
//@ts-ignore
editor._standaloneKeybindingService.addDynamicKeybinding('write-command' , monaco.KeyMod.Alt | monaco.KeyMod.Shift | monaco.KeyCode.KeyS , this.writeShortcutKey.bind(this));
}
writeShortcutKey can be called by Alt+Shift+S, whereas quickFix cannot be called by Command+P
Does anyone know what's the correct way to assign a shortcut to editor.action.quickFix?
This discussion was converted from issue #3055 on March 10, 2023 15:21.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Context
Description
I have an editor built by Monaco Editor. For certain texts, it returns certain code actions and quick fix.
However, the shortcut
Command + .
does not work in Mac and Chrome;Ctrl + .
does not work in Windows and Chrome either (I use French keyboard). (This is a working sample of quickFix provided by someone else, where shortcuts don't work either.)Does anyone know what may be the reason?
I then tried to overwrite the shortcuts. I have the following code in
index.tsx
:writeShortcutKey
can be called by Alt+Shift+S, whereas quickFix cannot be called by Command+PDoes anyone know what's the correct way to assign a shortcut to
editor.action.quickFix
?(* Link on StackOverflow: https://stackoverflow.com/questions/71734607 *)
Beta Was this translation helpful? Give feedback.
All reactions