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

Not able to register commands during JDT LS initialization #1084

Closed
BoykoAlex opened this issue Jun 28, 2019 · 0 comments · Fixed by #1085
Closed

Not able to register commands during JDT LS initialization #1084

BoykoAlex opened this issue Jun 28, 2019 · 0 comments · Fixed by #1085

Comments

@BoykoAlex
Copy link
Contributor

A JDT LS extension registers delegateCommandHanlder via org.eclipse.jdt.ls.core.delegateCommandHandler extension point. In this particular case it is Spring Boot LS registers add/remove classpath listener commands. Essentially JDT LS would be notifying the client about classpath changes of projects in the workspace. (This data from the client is forwarded to Spring Boot LS eventually)

This command is executed once Spring Boot LS initializes. However, there is a race condition. Spring Boot LS won't attempt to send add classpath listsner message until JDT LS is started. Spring Boot LS can only wait until JDT LS is initialized...

JDT LS doesn't register commands with the client at the initialization step because it needs to wait for configuration changed message to register/unregister commands based on the config settings.

Therefore the race condition is between Spring Boot LS send add classpath listener message and JDT LS registering dynamic capabilities for commands.

The race condition could have been avoided if there were some commands that could be registered at the JDT LS initialization stage. For example commands that are independent of configuration settings and would remain registered regardless.

I propose to introduce static flag for the command definition in the org.eclipse.jdt.ls.core.delegateCommandHandlerextension point. Thus,WorkspaceExecuteCommandHandlerwould havegetStaticCommands()andgetNonStaticCommands` methods. Static commands would be registered at the initialization stage while non-static commands would be registered if config changes or at the init stage if dynamic registration not supported.

PR is coming

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

Successfully merging a pull request may close this issue.

2 participants