Skip to content

Commit 33f604f

Browse files
committed
Merge branch 'main' into jep-486
2 parents 6d7d072 + 1861da0 commit 33f604f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+4915
-4762
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,7 @@ jobs:
5555
uses: actions/checkout@v4
5656
with:
5757
persist-credentials: false
58-
submodules: false
59-
60-
- name: Checkout NetBeans
61-
uses: actions/checkout@v4
62-
with:
63-
repository: apache/netbeans
64-
path: netbeans
65-
ref: 23
66-
67-
- name: Checkout NetBeans l10n
68-
uses: actions/checkout@v4
69-
with:
70-
repository: apache/netbeans-l10n
71-
path: netbeans-l10n
72-
ref: ece00239dc7a208fba60703c2256ffd818da1646
58+
submodules: true
7359

7460
- name: Apply NetBeans patches
7561
run: ant apply-patches

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
build/
2-
netbeans/
3-
netbeans-l10n/
42
.DS_STORE
53
.idea/
64
*.iml

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "netbeans-l10n"]
2+
path = netbeans-l10n
3+
url = https://github.com/apache/netbeans-l10n.git
4+
[submodule "netbeans"]
5+
path = netbeans
6+
url = https://github.com/apache/netbeans.git

BUILD.md

Lines changed: 100 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,21 @@
2727

2828
## Prerequisities
2929

30-
- JDK, version 11 or later upto JDK 22
30+
- JDK, version 17 or later
3131
- Ant, latest version
3232
- Maven, latest version
3333
- Node.js, latest LTS (to build VSIX)
3434

3535
## Fetching and building the code
3636

3737
```bash
38-
$ git clone https://github.com/oracle/javavscode.git
39-
$ cd javavscode/
40-
$ git clone https://github.com/apache/netbeans.git
41-
$ cd netbeans/
42-
$ git checkout 23
43-
$ cd ..
44-
$ git clone https://github.com/apache/netbeans-l10n.git
45-
$ cd netbeans-l10n
46-
$ git checkout ece00239dc7a208fba60703c2256ffd818da1646 # head commit in master
47-
$ cd ..
38+
$ git clone --recurse-submodules https://github.com/oracle/javavscode.git
39+
$ cd javavscode
4840
# the following target requires git executable to be on PATH:
4941
$ ant apply-patches
5042
$ ant build-netbeans
5143

52-
#Note if you do not wish to have l10n in scope then add no-l10n before any ant invocation target at beginning as below, by default l10n is enabled
44+
# Note if you do not wish to have l10n in scope then add no-l10n before any ant invocation target at beginning as below, by default l10n is enabled
5345
$ ant no-l10n apply-patches
5446
$ ant no-l10n build-netbeans
5547
```
@@ -67,26 +59,82 @@ The typical file name is `oracle-java-0.1.0.vsix`.
6759

6860
### Building for Development
6961

70-
If you want to develop the extension, use these steps for building instead:
71-
72-
```bash
73-
ant build-lsp-server
74-
```
75-
76-
This target is faster than building the `.vsix` file. Find the instructions
77-
for running and debugging below.
78-
79-
### Cleaning
62+
If you're developing the extension, follow these steps to build the project for faster iterations without packaging a `.vsix` file:
63+
64+
1. Run the following command to build the Language Server Protocol (LSP) server:
65+
```bash
66+
$ ant build-lsp-server
67+
```
68+
2. Navigate to the `vscode` folder:
69+
```bash
70+
$ cd vscode
71+
```
72+
3. Install the necessary Node.js dependencies:
73+
```bash
74+
$ npm install
75+
```
76+
4. Start the build watcher to automatically rebuild the extension on file changes:
77+
```bash
78+
$ npm run watch
79+
```
80+
81+
This process is faster than packaging the extension as a `.vsix` file, allowing for quicker development cycles.
82+
83+
### Debugging the Extension
84+
85+
Follow these steps to debug both the extension's TypeScript code and the NetBeans server code:
86+
87+
#### 1. Debugging TypeScript Code (VS Code Extension)
88+
1. Open the `vscode` folder in VS Code.
89+
2. Press `F5` to launch and debug the extension.
90+
91+
#### 2. Debugging NetBeans Code (Server Side)
92+
1. Open the **Command Palette** using `Ctrl+Shift+P` (or `Cmd+Shift+P` on macOS).
93+
2. Search for **Preferences: Open User Settings (JSON)** and select it.
94+
3. Locate or add the `jdk.serverVmOptions` setting in the JSON file and append the following arguments:
95+
```json
96+
"jdk.serverVmOptions": [
97+
"-Xdebug",
98+
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000"
99+
]
100+
```
101+
4. Start your debugging session. The NetBeans server will suspend execution and wait for a remote debugger to connect at port `8000`.
102+
103+
[NOTE: If you are using multiple profiles in VS Code, then set above configuration in appropriate profile
104+
105+
This configuration will enable you to debug both the extension’s TypeScript code and the NetBeans server-side code.
106+
107+
#### To enable Netbeans logs in the output channel of VS Code IDE
108+
109+
##### Option 1: Enable `jdk.verbose` Logging
110+
1. Open the **Command Palette** using `Ctrl+Shift+P` (or `Cmd+Shift+P` on macOS).
111+
2. Search for **Preferences: Open User Settings (JSON)** and select it.
112+
3. In the settings JSON file, add or update the following setting:
113+
```json
114+
"jdk.verbose": true
115+
```
116+
117+
##### Option 2: Enable NetBeans Logs via JVM Options
118+
1. Open the **Command Palette** using `Ctrl+Shift+P` (or `Cmd+Shift+P` on macOS).
119+
2. Search for **Preferences: Open User Settings (JSON)** and select it.
120+
3. Locate or add the `jdk.serverVmOptions` setting and append the following argument to the array:
121+
```json
122+
"jdk.serverVmOptions": ["-J-Dnetbeans.logger.console=true"]
123+
```
124+
125+
Both options will enable logging from the NetBeans server in the VS Code Output Channel.
126+
127+
### Cleaning the Extension
80128

81129
Often it is also important to properly clean everything. Use:
82130

83131
```bash
84-
ant clean-vscode-ext
85-
cd netbeans/
86-
netbeans$ ant clean
132+
$ ant clean-vscode-ext
133+
$ cd netbeans/
134+
$ ant clean
87135
```
88136

89-
### Testing
137+
### Testing the Extension
90138

91139
The `java.lsp.server` module has classical (as other NetBeans modules) tests.
92140
The most important one is [ServerTest](https://github.com/apache/netbeans/blob/master/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java)
@@ -107,3 +155,29 @@ $ npm_config_https_proxy=http://your.proxy.com:port ant test-vscode-ext
107155

108156
when executing the tests for the first time. That shall overcome the proxy
109157
and download an instance of `code` to execute the tests with.
158+
159+
## Working with git submodules
160+
161+
This project uses [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) . In particular netbeans and netbeans-l10n are submodules pointing to specific commits in their respective repositories .
162+
163+
### Switching Branches
164+
165+
Add the --recurse-submodules flag to the git checkout command to update the submodules during the checkout.
166+
```bash
167+
git checkout --recurse-submodules <branch_name>
168+
```
169+
Note:- Merging branches with submodules pointing to different commits can be tricky. Refer the [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) for more details on the same.
170+
171+
### Changing submodules versions
172+
173+
```bash
174+
# Fetching changes from remote submodule repositories
175+
git submodule update --remote
176+
# Changing the submodule version
177+
cd netbeans
178+
git checkout <commit_hash>
179+
cd ..
180+
# Committing the submodule version
181+
git add netbeans
182+
git commit -m "Updated netbeans"
183+
```

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ Java Platform extension from Oracle brings full featured development support (ed
4040
- For more information, see the section [Selecting the JDK](#selecting-the-jdk).
4141
4. Use any one of the following ways to start coding, compiling and debugging in Java.
4242
- Simply create a new Java class with `public static void main(String[] args)` method.
43-
- Use the __Java: New From Template...__ command to create a new Java file.
43+
- Use the __Java: New File...__ command to create a new Java file.
4444
- Use the __Java: New Project...__ command to create a new project.
4545
- Open the folder with existing __Maven__ or __Gradle__ project files (_pom.xml_ or _build.gradle, gradle.properties_).
4646

4747
## Supported Actions
4848
In the VS Code command palette :
4949
* __Java: New Project...__ allows creation of new Maven or Gradle project
50-
* __Java: New from Template...__ add various files to currently selected open project. Files are:
50+
* __Java: New File...__ add various files to currently selected open project. Files are:
5151
* Java - broad selection of various predefined Java classes
5252
* Unit tests - JUnit and TestNG templates for test suites and test cases
5353
* Other - various templates for Javascript, JSON, YAML, properties, ... files
@@ -169,7 +169,7 @@ Oracle Java Platform extension provides Test Explorer view which allows to run a
169169
### Localisation support
170170
Oracle Java Platform extension provides localisation support for _Japanese_ and _Simplified Chinese_.
171171
To switch language `Go to command Palette->Configure display language` select `ja` for _Japanese_ or `zh-cn` for _Simplified Chinese_
172-
![localisation.gif](localisation.gif)
172+
![localisation.gif](vscode/images/localisation.gif)
173173

174174
## Selecting the JDK
175175
The JDK to build, run and debug projects is being searched in the following locations:

0 commit comments

Comments
 (0)