Contributions are essential for keeping this extension great. We try to keep it as easy as possible to contribute changes and we are open to suggesstions for making it even easier. There are only a few guidelines that we need contributors to follow.
vscode-java is a Visual Studio Code extension that uses a language server for its Java language smartness. Usually vscode-java features depend on the Eclipse ™ JDT Language Server, (a.k.a. eclipse.jdt.ls) and the contributions should be coordinated between the two repositories.
-
Install prerequisites:
- latest Visual Studio Code
- Node.js v4.0.0 or higher
-
Fork and clone the repository
-
cd vscode-java
-
Install the dependencies:
$ npm install
-
Open the folder in VS Code
This assumes that you are starting on the vscode-java
directory
-
cd ..
-
Fork and clone the eclipse.jdt.ls repository
-
Build server
$ cd ..\vscode-java $ npm run build-server
You can run faster server builds during development by calling ./node_modules/.bin/gulp dev_server
script instead, this will build server binaries that are required by your host OS only. You can also use npm run watch-server
which will build and place them on the extension for Java changes. These commands run Maven in offline mode, so you might need to run build-server
at least once, to fetch all the dependencies.
This will build and place the binaries under the server
folder. Alternately you can download and use the latest snapshot build from Eclipse ™ JDT Language Server project with the following
```bash
$ cd ..\vscode-java
$ ./node_modules/.bin/gulp download_server
```
While developping the language server and the extension, you don't need to deploy the server every time to try out changes. Instead you can run the language server out of its Eclipse workspace:
- Open VSCode on the
vscode-java
folder - In the debug viewlet, run the launch Launch Extension - Remote Server
- The extension will open a socket on port 3333 and will wait for the JDT language server to connect
- In Eclipse, run the JDT language server as an Eclipse application.
- Create a debug configuration of type Eclipse Application.
- in the main tab of the debug configuration set the product to
org.eclipse.jdt.ls.core.product
. - in the Environment tab, define a variable
CLIENT_PORT
with value3333
. - if your workspace contains 'org.eclipse.jdt.ui', use the Plug-Ins tab in the debug configuration to exclude the plug-in. The presence of 'org.eclipse.jdt.ui' will cause the language server to hang.
- In the debug console of VSCode you can see if the connection was sucessful.
- When the server is running breakpoints can be reached and hot code replace can be used to make fixes without restarting the server.
- You can modify
launch.json
to use a different port:- Modify
SERVER_PORT
to specify the port the JST LS server should connect to.
- Modify
You can create a binary that you can sideload to your VS Code installation.
-
Fork and clone this repository
-
cd vscode-java
-
Install the dependencies:
$ npm install
-
Optionally, follow the instruction to build the server.
-
See documentation on extension installation on ways to sideload or share.
If you encounter a problem and know it is caused by eclipse.jdt.ls, then please open a bug report over there. In doubt, you can report issues in the vscode-java issue tracker.
Try to collect as much informations as you can to describe the issue and help us reproduce the problem. Head over to the troubleshooting page to see how to collect useful logging informations.