Monaco-editor: editor.addCommand returns a command id string instead of a disposable

Created on 4 Jul 2018  路  5Comments  路  Source: microsoft/monaco-editor

monaco-editor version: 0.13.1
Browser: Chrome 67
OS: macOS

In this file, StandaloneCodeEditor.addCommand returns a commandId instead of a disposable. Is there any specific reason for it? If yes, then how do I remove a manually added command with public api?

api feature-request

All 5 comments

@alexandrudima I got the same question.
And is there a way to dispose added command ?

You could simply switch to addAction and also define a label. The only real difference is that the F1 list will then show your command, which is not that bad...

@alexdima What you prescribe won't work for code lens out of the box unless you created some other machinery.

I don't found a method to reject addCommand 锛宐ut I found it won't be called multiply by repeat define addCommandin a react hook. Was the addCommandjust like a Singleton? And I still want to know how to reject it.

The upcoming editor release will add monaco.editor.registerCommand to cover this usecase. (via https://github.com/microsoft/vscode/commit/7c937a7a383ca131c5e36811d4440878c97a1191)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandalorian picture brandalorian  路  3Comments

galyech picture galyech  路  3Comments

andreymarchenko picture andreymarchenko  路  3Comments

galusben picture galusben  路  3Comments

SoftTimur picture SoftTimur  路  3Comments