Apache NetBeans Language Server Extension for VS Code
This is a technology preview of Apache NetBeans based extension for VS Code. Use it to get all the goodies of NetBeans via the VS Code user interface! Runs on JDK8[*] and all newer versions.
Apache NetBeans Language Server brings full featured Java development (edit-compile-debug & test cycle) for Maven and Gradle projects to VSCode. As well as other features.
Project Explorer provides an overview of logical project structure, groups sources together and greatly simplifies Java package structure exploration. Project Explorer is an addition to the classical workspace explorer. Use it to build, test, execute and operate your Maven and Gradle Java projects.
Debugger and Launch Configurations
Language Server Java 8+ ... launch configuration supports debugging and running Java applications using JDK8 or newer.
Default launch configurations provided by Language Server can modified in
Run Configurations panel
Program arguments, VM options, evironment variables,... can be set in Run Configuration panel a part of Explorer. The panel is sufficient for all typical use-cases Java programmer faces. Only advanced, expert scenarios may require touching of
Class level refactorings as well as variable refactorings are supported in VSCode via Apache NetBeans extension. See following screenshots:
Source Action ... context menu
Introduce refactorings available via Show Code actions light bulb
More Refactorings available also using Refactor... context menu
Surroung with refactorings
Some refactorings are two steps with like Override method ... where method to be overriden is selected in 2nd step:
Change Method Parameters refactoring
Change method parameters refactoring is provided using dedidacated form allowing to change, add, move, remove method parameters.
Move Members Refactoring
Move members refactoring provides dedicated form as well.
Some of supported refactorings:
Out of the box support for organizing imports in Java sources is available. It removes unused imports, groups imports by packages and updates your imports whenever a file is saved. In addition to the defaults, there is a rich set of configuration options.
Go to VSCode
JavaDoc smart editing
When adding JavaDoc to code NetBeans assists by suggesting to insert preformatted and prepopulated JavaDoc comment. Type
Source Code formatting
Formatting source code is possible using also other styles than NetBeans. Eclipse, Google and Spring formatters can be used. For Eclipse formatter simply export settings from Eclipse IDE into standard file and then set
NetBeans Language Server provides Test Explorer view which allows to run all tests in a project, examine the results, go to source code and run particular test.
Native Image Debugger
NetBeans Language Server allows Java like debugging of native images produced by GraalVM native-image tool. It is provided using GDB and via new Run configuration named Launch Native Image. This experimental feature works now only on Linux with certain version of GDB, see above.
In order to debug native image applications it is necessary to build such native image with debug information available. It can be done by providing following switches for native-image tool:
Using Native Image Maven Plugin
It is possible to use Native-Image Maven Plugin to run native-image builds for Maven projects.
In this case add following
Setting project's Maven pom.xml to skip native-image build everytime when project is being built is a good practice.
When native image is built, including debug info then add Launch Native Image configuration to launch.json. Select it in Run & Debug activity window and press F5 to debug Java source code on native image.
Database Explorer allows to connect to databases using appropriate JDBC drivers.
Make Default Connection sets selected Database connection as default for IDE. This connection is then used by all IDE editors for SQL Code completion, or Micronaut Data queries, e.g.
Oracle Cloud Infrastructure Explorer supports viewing compartments and resources available on user OCI instance. It is defined by OCI config file which has to be downloaded according to OCI instructions and saved in
It is possible to add JDBC connection to Oracle Autonomous DB running in OCI using Add DB Connection menu. It downloads DB Wallet automatically.
Selecting the JDK
The user projects are built, run and debugged using the same JDK which runs the Apache NetBeans Language Server. The JDK is being searched in following locations:
As soon as one of the settings is changed, the Language Server is restarted.
Running Language Server per VSCode workspace or for user
It is possible to run Apache NetBeans Language Server per workspace (VSCode window). This allows separation of Language Server for given project as Language Server JVM is not shared for more VSCode open workspaces (projects).
It is possible to change this in
Conflicts with other Java Extensions
Apache NetBeans Language Server extension isn't the only Java supporting extension. To avoid duplicated code completion and other misleading clashes the extension disables certain functionality known to cause problems, this is done per Workspace.
This behavior can be disabled by setting
Read building instructions to help Apache community to improve the extension.