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

Shortcuts like in JDT UI editor #43

Open
akurtakov opened this issue Mar 30, 2023 · 2 comments
Open

Shortcuts like in JDT UI editor #43

akurtakov opened this issue Mar 30, 2023 · 2 comments

Comments

@akurtakov
Copy link
Collaborator

Is there a possibility to have shortcuts like Ctrl+Shift+O bound to organize imports so one doesn't have to go through Ctrl-1 which is too crowded.

@mickaelistria
Copy link
Collaborator

JDT-LS does provide an organize import LSP command IIRC, We should then map this LSP command to and Eclipse IDE command and map it to such shortcut.
Given the popularity of this shortcut in Java world, I'm wondering whether it should be an operation standardized in LSP directly, ie whether we should start the process of submitting an issue and a proposal to LSP directly? @rgrunber @Speco @Eskibear what do you think?

@rgrunber
Copy link
Member

Just as a quick example, here's how it works in vscode-java.

https://github.com/redhat-developer/vscode-java/blob/7e7dfa945f87630daf7a039fa78de8e013904b0e/src/sourceAction.ts#L114-L119

This registers a command, that calls java/organizeImports on the server. This endpoint is supported through https://github.com/eclipse/eclipse.jdt.ls/blob/1a44853b75397e7cb6625013b0be34d924ba673c/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JDTLanguageServer.java#L1025 .

We also offer a delegate command at https://github.com/eclipse/eclipse.jdt.ls/blob/1a44853b75397e7cb6625013b0be34d924ba673c/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JDTDelegateCommandHandler.java#L61-L74 for organize imports but I think this one has no way to prompt the user in the event you have multiple fully qualified names that match the name of some given type.

In VS Code, any command can be bound to a keybinding, so that's entirely up to the client.

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

3 participants