Monaco-editor: Implementing custom "quickOpen" menus (i.e. 'Go to file', etc)

Created on 21 May 2017  Â·  4Comments  Â·  Source: microsoft/monaco-editor

Digging through the Monaco source code, it looks like quickOpen functionality is included (used for 'go to file', etc in VS Code — https://unpkg.com/[email protected]/dev/vs/editor/editor.main.js and Ctrl+F for quickOpen).

I've searched all open issues here, StackOverflow, etc but I can't find anything about implementing custom quickOpen menus in Monaco.

https://github.com/Microsoft/monaco-editor/issues/199 talks about customizing the context menu specifically, but I want to create an entirely new menu trigged by custom keyboard shortcuts. Any pointers on how one would go about doing this?

Most helpful comment

This can be done by:

  • adding an overlay widget via editor.addOverlayWidget(...)
  • the widget can be made to be hidden.
  • registering an action via editor.addAction(...)
  • one the action is invoked (via a keybinding, context menu, or from the F1 list), the action can cause the overlay widget to be revealed and you can show whatever you want in there.

All 4 comments

This can be done by:

  • adding an overlay widget via editor.addOverlayWidget(...)
  • the widget can be made to be hidden.
  • registering an action via editor.addAction(...)
  • one the action is invoked (via a keybinding, context menu, or from the F1 list), the action can cause the overlay widget to be revealed and you can show whatever you want in there.

@alexandrudima Is there a way to access the Implementation the Command Palette(as example) uses, or has the Widget to be implemented by myself?
By implementation i mean the frontend textfield with the list under it that holds all the available items.

@chrmarti has managed (in a hacky way) to get ahold of the command palette in the standalone editor. Maybe he remembers all that he had to do.

Attaching the TS file (as .txt) that mimics VS Code's QuickOpen for Monaco (server-side not included). I had it running with "monaco-editor": "0.13.1". HTH

quickOpenFile.txt

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ststeiger picture ststeiger  Â·  3Comments

zeegin picture zeegin  Â·  3Comments

Kang-Jun-sik picture Kang-Jun-sik  Â·  3Comments

Spongman picture Spongman  Â·  3Comments

poloten4uk picture poloten4uk  Â·  3Comments