Skip to content

Adding custom keybindings to modern-monaco #39

Description

@hybridherbst

Hi, I'm trying to add custom shortcuts to modern-monaco.

I figured out a few things already.
I can get the underlying monaco instance from lazy() by accessing the workspace:

workspace._monaco.promise.then(monaco => {
  const editor = monaco.editor;
  editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, () => {
        runCustomCode();
    });
});

However, I'm running into issues like this:

client.js:3208 Cannot add keybinding because the editor is configured with an unrecognized KeybindingService
warn	@	client.js:3208
addAction	@	editor-core.mjs:191902

Could you provide an example for how to use the underlying editor instance and add things to it? Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions