-
Notifications
You must be signed in to change notification settings - Fork 4
Launch (Develop) a JDT LS instance with Bazel extension
- JDK 11
- Launch an Eclipse instance
- Create and launch a clean workspace
- Open the repository by clicking
File -> Open Projects from File System...
- In the Import view leave selected the following two and click
Finish
:bazel-ls-eclipse
,bazel-ls-eclipse/com.salesforce.b2eclipse.jdt.ls
- Once the project is opened, you will see a lot of errors in the
Problems
view. It happens because we are on a default target platform. Locate the target platform’s file in the Explorer, open it and clickSet as Active Target Platform
. - Once the target platform is set, there should be no errors. Next step - starting JDT LS instance. Locate the launch file in the Explorer and run it.
-
Problems view continues to show some errors after the platform is set.
- Try to rebuild the project (Project -> Clean...)
- Try to reload the platform (same steps as making it active)
- Try to restart the Eclipse
- Make sure the proper Java runtime is set (JDK 11)
- Nothing happens after the launch.
- Open the Console view manually and make sure there are no errors and Terminate button is enabled. If not, try to run the server again.
If you don't use VS Code for PDE development (specifically for bazel-ls-eclipse
) and just want to test how it works with already started JDT LS instance (e.g. through Eclipse) then proceed to the next section.
-
Open the project directory from a VS Code instance;
-
Install all the recommended extensions. You can do it in either ways:
- Via popup prompt when you open the project. Click “Install All” and wait until the process is finished;
- Manually. First open the Extensions tab and apply the @recommended filter. Then install the extensions one by one or all at once.
The required set of extensions includes:
-
Once the plugins are installed, wait until the target platform is loaded. Usually this process is started automatically. You will see a spinning icon in the status bar. More details can be found by clicking on the icon. If the process wasn’t started, locate the target platform’s file in the Explorer, right click on it and choose Reload Target Platform;
-
Launch the JDT LS with Bazel support. Locate the launch file in the Explorer, right click on it and choose Debug PDE application.
- If you run the launch configuration in an Eclipse instance, it will override (reformat) some of its keys. E.g.
selected_target_plugins
will becomeselected_target_bundles
with a slightly different format. In that case you won't be able to run the project in VS Code gettingClassNotFoundException
. You will have to reset the changes to the launch configuration file to make it work again in VS Code.