Skip to content

Commit 51aecc4

Browse files
NikolasKomonenfbricon
authored andcommitted
Updating CONTRIBUTING with images for setting up remote debugging
Signed-off-by: Nikolas Komonen <nikolaskomonen@gmail.com>
1 parent 06793b1 commit 51aecc4

13 files changed

+124
-22
lines changed

CONTRIBUTING.md

Lines changed: 124 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,54 +11,156 @@ vscode-java is a Visual Studio Code extension that uses a language server for it
1111
smartness. Usually vscode-java features depend on the [Eclipse &trade; JDT Language Server](https://github.com/eclipse/eclipse.jdt.ls),
1212
(a.k.a. eclipse.jdt.ls) and the contributions should be coordinated between the two repositories.
1313

14-
## First Time Setup
15-
1. Install prerequisites:
14+
#
15+
16+
## Background Info
17+
18+
For the whole language server to get up and running it requires
19+
two parts.
20+
21+
**A)** The Client Side (this repo): [VSCode Java](https://github.com/redhat-developer/vscode-java)
22+
23+
**B)** The Server Side: [JDT LS](https://github.com/eclipse/eclipse.jdt.ls)
24+
25+
#
26+
27+
## Complete Setup Guide
28+
29+
The following will be a start to finish guide to get the entire language server up and running.
30+
31+
#
32+
33+
## **A)** Client Side Setup
34+
35+
1. Install the required software:
1636
* latest [Visual Studio Code](https://code.visualstudio.com/)
1737
* [Node.js](https://nodejs.org/) v4.0.0 or higher
18-
2. Fork and clone the repository
38+
2. Fork and clone [this repository](https://github.com/redhat-developer/vscode-java)
39+
40+
Keep in mind the final directories will look like:
41+
42+
```
43+
PROJECT_FOLDER/
44+
|
45+
|--- vscode-java/
46+
|--- eclipse.jdt.ls/
47+
48+
```
49+
50+
1951
3. `cd vscode-java`
2052
4. Install the dependencies:
2153

2254
```bash
2355
$ npm install
2456
```
25-
5. Open the folder in VS Code
2657

27-
## Building Eclipse &trade; JDT Language Server
58+
#
59+
60+
## **B)** Server Side Setup
2861
This assumes that you are starting on the `vscode-java` directory
2962

3063
1. `cd ..`
3164
2. Fork and clone the [eclipse.jdt.ls](https://github.com/eclipse/eclipse.jdt.ls) repository
65+
66+
Ensure the directory looks like:
67+
```
68+
PROJECT_FOLDER/
69+
|
70+
|--- vscode-java/
71+
|--- eclipse.jdt.ls/
72+
73+
```
3274
3. Build server
3375

3476
```bash
35-
$ cd ..\vscode-java
77+
$ cd ./vscode-java
3678
$ npm run build-server
3779
```
80+
81+
**\*Optional:**
3882
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.
3983

4084
This will build and place the binaries under the `server` folder. Alternately you can download and use the latest snapshot build from [Eclipse &trade; JDT Language Server](https://github.com/eclipse/eclipse.jdt.ls) project with the following
4185

42-
```bash
43-
$ cd ..\vscode-java
44-
$ ./node_modules/.bin/gulp download_server
45-
```
86+
```bash
87+
$ cd ../vscode-java
88+
$ ./node_modules/.bin/gulp download_server
89+
```
90+
### Setting up the JDT Language Server in Eclipse
91+
92+
4. In Eclipse, import a maven project:
93+
94+
![Import Project](images/changelog/importProject.png)
95+
96+
![Import Project](images/changelog/importMavenProject.png)
4697

47-
## Run with a remote JDT language server
98+
Select the `eclipse.jdt.ls` folder, then click yes/accept to all
99+
following prompts:
100+
101+
![Import Project](images/changelog/importedMavenProject.png)
102+
103+
5) Now we need to use Tycho to download the dependencies,
104+
this will get rid of the errors.
105+
106+
At the top right arrow it will say `Set Target Platform`, select that and continue.
107+
108+
![Import Project](images/changelog/setTargetPlatform.png)
109+
110+
After it will change to `Reload Target Platform` select that:
111+
112+
![Import Project](images/changelog/reloadTargetPlatform.png)
113+
114+
6) Wait till the bottom right is done loading:
115+
116+
![Import Project](images/changelog/loadingTargetPlatform.png)
117+
118+
once 100%:
119+
120+
121+
122+
The errors should now be gone.
123+
124+
#
125+
# Running Everything
126+
127+
## **C)** Run with a remote JDT language server
48128

49129
While developing 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:
50130

51-
### _Launch Extension - Remote Server_
52-
53-
- Open VSCode on the `vscode-java` folder
54-
- In the debug viewlet, run the launch _Launch Extension - Remote Server_
55-
- The extension will open a socket on port 3333 and will wait for the JDT language server to connect
56-
- In Eclipse, run the JDT language server as an Eclipse application.
57-
- Create a debug configuration of type _Eclipse Application_.
58-
- in the main tab of the debug configuration set the product to `org.eclipse.jdt.ls.core.product`.
59-
- in the Environment tab, define a variable `CLIENT_PORT` with value `3333`.
60-
- 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.
61-
- You can also use the `jdt.ls.remote.server` launch configuration.
131+
### a) _Launch Extension - Client Side_
132+
133+
1. Open VSCode on the `vscode-java` folder
134+
135+
2. In the debug viewlet, run the launch _Launch Extension - Remote Server_
136+
![Remote Server](images/changelog/RemoteServer.png)
137+
138+
3. The extension will open a socket on port 3333 and will wait for the JDT language server to connect
139+
140+
141+
142+
### b) _Setup Debug Server - Server Side_
143+
144+
[**\*Skip to C if this option exists\***](#c-launch-debug-server---server-side)
145+
146+
In Eclipse, run the JDT language server as an Eclipse application.
147+
1) Create a debug configuration of type _Eclipse Application_.
148+
![Creation Menu](images/changelog/DebugConfigurationOpen.png)
149+
150+
![New Configuration](images/changelog/CreateNewConfiguration.png)
151+
2) in the main tab of the debug configuration set the product to `org.eclipse.jdt.ls.core.product`.
152+
153+
![Choose Product](./images/changelog/ChooseProduct.png)
154+
3) in the Environment tab, define a variable `CLIENT_PORT` with value `3333`.
155+
156+
![Define Port](images/changelog/ClientPort.png)
157+
4) 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.
158+
159+
### c) _Launch Debug Server - Server Side_
160+
161+
- With the client side **(vscode-java) running**, you can start the remote server.
162+
163+
![Define Port](images/changelog/DebugRemoteServer.png)
62164

63165
- In the debug console of VSCode you can see if the connection was successful.
64166
- When the server is running breakpoints can be reached and hot code replace can be used to make fixes without restarting the server.

images/changelog/ChooseProduct.png

38.5 KB
Loading

images/changelog/ClientPort.png

14.1 KB
Loading
10.9 KB
Loading
29.9 KB
Loading
11.6 KB
Loading

images/changelog/RemoteServer.png

20.8 KB
Loading
37.5 KB
Loading

images/changelog/importProject.png

36.3 KB
Loading
85.5 KB
Loading

0 commit comments

Comments
 (0)