This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Connect to a running JDT LS instance
Pavel Mitrafanau edited this page May 9, 2021
·
1 revision
- Install the required software:
- latest Visual Studio Code
- Node.js v4.0.0 or higher (up to 11.x; doesn't work with 12 and 13)
- Fork and clone this repository
cd vscode-java
- Install the dependencies:
$ npm install
- Make sure the path to the JDK is set correctly. It is searched in the following order:
- the JDK_HOME environment variable
- the JAVA_HOME environment variable
- In the VS Code open the
vscode-java
project - Open
settings.json
(User) and append the following fields:
{
// ...
"java.import.bazel.enabled": true,
"java.import.bazel.src.path": "/java/src",
}
Where java.import.bazel.src.path
specifies a path to java sources relatively to the packages in your Bazel project. So it means that all of your packages must conform to this layout.
- In the debug viewlet, run the Launch Extension - JDTLS Client
- Once the test instance in started, open your Bazel project
- Open any
.java
file and wait until the import process is finished (once spinner is stopped). Then you can check whether code navigation (or completion) works.
In case you've run into a problem not listed here and can't find a solution, clean the workspace directory and try again.
- Your Bazel project is being loaded too much time. First, close it. Restart the JDT LS and then try to follow the steps above once again (starting from step 9).