This is an early work-in-progress extension for vscode-java. It aims at providing support for the JBang scripts written in Java (and partial support for Kotlin and Groovy).
Pre-requisites:
jbang.home
preference to point to a JBang
installationOutstanding issues:
java.import.jbang.projectPerScript
setting to true
, each script in the folder will be assigned a specific classpath. Toggling this setting requires calling the Java: Clean Java Language Server Workspace
command to take effect.//DEPS
//SOURCES
and //FILES
//JAVA_OPTIONS
, //JAVAC_OPTIONS
, //RUNTIME_OPTIONS
and //COMPILE_OPTIONS
Run JBang
or Debug JBang
codelens, that show on top of the type declaration or main method, if there is one.JBang > Synchronize JBang
will add the script's parent folder to the project's source path and the JBang dependencies will be added to the project's classpath.JBang: Create a new script
command.build.jbang
files: If a folder containing build.jbang
is opened, it'll be used to configure the Java settings of its //SOURCES. Currently, changes in build.jbang
require manually triggering the JBang > Synchronize JBang
command (via codelens or context menu) to take effect.JBang > Export as native binary
menu. This requires GraalVM to be installed with the native-image extension. See https://www.jbang.dev/documentation/guide/latest/usage.html#build-and-run-native-image-experimentalJBang > install application
menu. Select the application name and whether to generate a native application or not. See https://www.jbang.dev/documentation/guide/latest/install.htmljava.configuration.runtimes
.jbang-catalog.json
files)jbang.home
: Specifies the folder path to the JBang directory (not the executable), eg. ~/.sdkman/candidates/jbang/current
. On Windows, backslashes must be escaped, eg C:\\ProgramData\\chocolatey\\lib\\jbang
. Used by the JBang: Create a new script
wizard and the Run JBang
code lens. Useful in case jbang
is not automatically picked up from the $PATH, for some reason.jbang.wizard.templates.showDescriptions
: When set to true
(the default), shows JBang template descriptions in the JBang: Create a new script
wizard, else hides them.java.import.jbang.projectPerScript
: When set to true
, each script found in the opened folder will be imported as its own project, with its own classpath. false
by default. Toggling this setting requires calling the Java: Clean Java Language Server Workspace
command to take effect.jbang.completion.onSelect.autosave
: When set to true
(the default), automatically save the file after //DEPS
completion is selected, so the classpath gets updated.Continuous Integration builds can be installed from the Visual Studio Marketplace, as Pre-release builds. Alternatively, you can head to https://github.com/jbangdev/jbang-vscode/releases/tag/latest, download the most recent jbang-vscode-<version>.vsix
file and install it by following the instructions here.
Step 1. Fork and clone this repository
Step 2. Fork and clone the jbangdev/jbang-eclipse repository, which contains the JBang/Eclipse core plugin and its jdt.ls extension
Note: Ensure that the cloned repositories are under the same parent directory:
YOUR_FOLDER/
├──── jbang-vscode/
├──── jbang-eclipse/
Step 3. Navigate into jbang-vscode/
$ cd jbang-vscode/
Step 4. Install npm dependencies
$ npm ci
Step 5. Build the JBang/Eclipse integration plugin and its jdt.ls extension
$ npm run build-ext
This script places the built jars in jbang-vscode/jars/
.
Step 6. Build the VS Code extension
$ npx vsce package
This will generate a jbang-vscode-<version>.vsix
file in the jbang-vscode/
directory.