salesforce / bazel-ls-eclipse Goto Github PK
View Code? Open in Web Editor NEWPOC of a Java-only language server for Bazel
POC of a Java-only language server for Bazel
Currently we getting next exception on file close/open cycle:
java.lang.IllegalStateException: Attempt to retrieve the classpath of a Bazel Java project prior to setting up the Bazel workspace.
at com.salesforce.b2eclipse.classpath.BazelClasspathContainer.getClasspathEntries(BazelClasspathContainer.java:120)
“initialize” request, which is sent from the client, triggers build process against the current workspace asynchronously without waiting for the finishing of the build:
/* (non-Javadoc)
* @see org.eclipse.lsp4j.services.LanguageServer#initialize(org.eclipse.lsp4j.InitializeParams)
*/
@Override
public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
logInfo(">> initialize");
InitHandler handler = new InitHandler(pm, preferenceManager, client, commandHandler);
return CompletableFuture.completedFuture(handler.initialize(params));
}
After that the client sends “initialized” notification (see org.eclipse.lsp4j.services.LanguageServer#initialized
for JavaDoc).
The handler of the “initialized” notification should wait for the build process to complete (see the code snippet below):
/*
* (non-Javadoc)
* @see org.eclipse.lsp4j.services.LanguageServer#initialized(org.eclipse.lsp4j.InitializedParams)
*/
@Override
public void initialized(InitializedParams params) {
logInfo(">> initialized");
try {
Job.getJobManager().join(InitHandler.JAVA_LS_INITIALIZATION_JOBS, null);
} catch (OperationCanceledException | InterruptedException e) {
logException(e.getMessage(), e);
}
...
}
The problem of the synchronization occurs in the case when build jobs are not started yet on the server-side, but the notification is received and the server tries to wait for the initialization jobs to be completed. In this situation, the “join” method returns immediately and lets the execution runs further with wrong results.
for the complete code see org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer
Rebuild project if BUILD and WORKSPACE were change. Implement IBuildSupport extension.
Required changes in external repositories:
eclipse-jdtls/eclipse.jdt.ls#1694
redhat-developer/vscode-java#1825
right after import is finished VSCode sends workspace/didChangeConfiguration
command including java.home
. during it processing I'm getting:
java.lang.NullPointerException
at org.eclipse.jdt.ls.core.internal.JVMConfigurator.configureDefaultVM(JVMConfigurator.java:88)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.didChangeConfiguration(JDTLanguageServer.java:432)
...
recently plugin was made as an extension for eclipse.jdt.ls so we moved to own *.target, *.launch files and sorrowfully missed something - org.eclipse.jdt.launching.macosx
have to be added to launch configurations.
Test case import project build with workspace.
Test case import project build with class.
Test case import project build with subpackage.
Сhanging the build file does not update the dependencies in the Java class
Rebuild project if BUILD and WORKSPACE were change. Implement IBuildSupport extension.
At the moment their import silently breaks
Use cases:
source/test path locations should be overridable via params of initialize request (LSP).
also Bazel support feature of eclipse.jdt.ls should be configurable in the same way.
jdtls + lsp bug (not waiting for jobs to complete)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.