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

Implement editor.action.rename comand #5215

Closed
tsmaeder opened this issue May 22, 2019 · 3 comments
Closed

Implement editor.action.rename comand #5215

tsmaeder opened this issue May 22, 2019 · 3 comments

Comments

@tsmaeder
Copy link
Contributor

tsmaeder commented May 22, 2019

Implement the vs code built-in command editor.action.rename as mentioned in eclipse-che/che#13007

@JPinkney
Copy link
Contributor

Just wanted to post this because it seems relevant to this and the other issues implementing the commands and it might be helpful (And I just happened to find this yesterday and I'm not sure if anyone knew).

It looks like some of the commands are already registered and working they are just registered under different id's. I.e. editor.action.rename is monaco.editor.action.rename. I've just done a quick 5 minute test and it seems like we can just wrap the monaco.editor.action.rename command with something like

commands.registerCommand({ id: 'editor.action.rename' }, {
            execute: () => {
                commands.executeCommand('monaco.editor.action.rename');
            }
});

and it will work. I've tested with both typescript and java so far.

It also looks like other commands that we need to implement for this sprint are accessible as well.
editor.action.formatSelection is monaco.editor.action.formatSelection
editor.action.formatDocument is monaco.editor.action.formatDocument
editor.action.gotoDeclaration is monaco.editor.action.gotoDeclaration

@tsmaeder
Copy link
Contributor Author

In the past, we had trouble with that approach because the command registry in the editor was forwarding to the general registry and this was leading to an endless recursion. What is different here? Also, usually monaco stuff uses different coordinates (0-based vs. 1-based). Does all that pan out?

@JPinkney
Copy link
Contributor

So I've opened up a PR and verified that the three commands listed are behaving correctly. I guess I must have misread the commands list because editor.action.gotoDeclaration does not seem to be in the commands there (and it shouldn't be anyways because monaco needs to be updated).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants