/liberty-tools-vscode

VS Code extension for Liberty Tools

Primary LanguageTypeScriptEclipse Public License 2.0EPL-2.0

Liberty Tools for VS Code

Marketplace Version License

A VS Code extension for Open Liberty. The extension will detect your Liberty Maven or Liberty Gradle project if it detects the io.openliberty.tools:liberty-maven-plugin in the pom.xml or io.openliberty.tools:liberty-gradle-plugin in the build.gradle. Through the Liberty Dashboard, you can start, stop, or interact with Liberty dev mode on all available Liberty Maven or Liberty Gradle projects in your workspace.

Liberty Tools Extension

Quick Start

  • Install the extension
  • Liberty supported projects will appear in the Liberty Dashboard on the side bar
  • Right-click a project in the Liberty Dashboard to view the available commands

Features

  • View supported liberty-maven-plugin(version 3.1 or higher) or liberty-gradle-plugin(version 3.0 or higher) projects in the workspace
  • Start/Stop dev mode
  • Start dev mode with custom parameters
  • Run tests
  • View unit and integration test reports

Commands

Command Description
Start Starts dev mode.
Start…​ Starts dev mode with custom parameters. Supported parameters can be found in the documentation for the dev goal of the Liberty Maven Plugin and the libertyDev task of the Liberty Gradle Plugin.
Start in container Starts dev mode with the server in a container. The liberty-maven-plugin must be version 3.3-M1 or higher. The liberty-gradle-plugin must be version 3.1-M1 or higher.
Stop Stops dev mode.
Run tests Runs the unit tests and integration tests that are configured for your project. This command requires dev mode to be already started.
View integration test report Views the integration test report file.
View unit test report Views the unit test report file.

Note: Gradle projects only have a single View test report command.

Configurable User Settings

Setting Description Default Value
liberty.terminal.useJavaHome If this value is true, and if the setting java.home has a value, then the environment variable JAVA_HOME will be set to the value of java.home when a new terminal window is created. False

External Settings

The following settings provided by external extensions will be honoured when executing dev mode commands.

Setting Description Provided By
maven.executable.path Maven commands executed by dev mode will honour this setting. When this value is empty, it tries to use mvn or mvnw accroding to the value of maven.executable.preferMavenWrapper. Maven for Java extension
maven.executable.preferMavenWrapper Maven commands executed by dev mode will honour this setting. If true, it tries to use mvnw if a Maven wrapper file can be found. Otherwise it will use mvn. Maven for Java extension
java.import.gradle.wrapper.enabled Gradle commands executed by dev mode will honour this setting. If true, it tries to use gradlew if a Gradle wrapper file can be found. Otherwise it will use gradle. Language support for Java extension

Requirements

Contributing

Contributions to the Liberty Tools extension are welcome!

Our CONTRIBUTING document contains details for submitting pull requests.

To build the extension locally:

  1. git clone https://github.com/OpenLiberty/liberty-dev-vscode-ext

  2. cd liberty-dev-vscode-ext

  3. Execute npm install

  4. Run the extension in Debug and Run mode by selecting Run Extension or F5

    Alternatively, build a .vsix file:

    • vsce package to generate the liberty-dev-vscode-ext-xxx.vsix file
    • Install the extension to VS Code by View/Command Palette
    • Select Extensions: Install from VSIX... and choose the generated liberty-dev-vscode-ext-xxx.vsix file

Localization

package.json

This follows vscode extenstion standard: add localized strings in package.nls.{locale}.json. The default nls message file is package.nls.json.

Source code

  1. Add new messages in locales/{locale}.json file. If message has parameters, use curly brackets to enclose them: {0}, {1}...

  2. Add the following import statement in your source code:

    import { localize } from "../util/i18nUtil";
  3. Call method localize to return localized message.

    Example without parameters:

    const message = localize("my.message.key");

    Example with parameters:

    const message = localize("my.message.key.with.params", param1, param2);

Issues

Please report bugs, issues and feature requests by creating a GitHub issue.