Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor.addCommand returns a command id string instead of a disposable #942

Closed
brijeshb42 opened this issue Jul 4, 2018 · 5 comments
Closed
Labels
editor-api feature-request Request for new features or functionality
Milestone

Comments

@brijeshb42
Copy link
Contributor

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?

@troy351
Copy link
Contributor

troy351 commented Feb 16, 2019

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

@alexdima
Copy link
Member

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 alexdima added editor-api feature-request Request for new features or functionality labels Dec 12, 2019
@alexdima alexdima added this to the Backlog milestone Dec 12, 2019
@bryanl
Copy link

bryanl commented Aug 19, 2020

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

@929853209
Copy link

I don't found a method to reject addCommand ,but 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.

@alexdima
Copy link
Member

alexdima commented Jan 4, 2021

The upcoming editor release will add monaco.editor.registerCommand to cover this usecase. (via microsoft/vscode@7c937a7)

@alexdima alexdima closed this as completed Jan 4, 2021
@alexdima alexdima modified the milestones: Backlog, December 2020 Jan 4, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-api feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

5 participants