Note: Starting with the 0.1.12 early release, Java 17 is required to run Liberty Tools for Visual Studio Code.
Ensure you have Node.js and npm installed.
-
Fork this repository
-
Clone your fork of this repository:
git clone https://github.com/<your GitHub id>/liberty-tools-vscode
-
Change to the
liberty-tools-vscode
directory:cd liberty-tools-vscode
-
Run
npm install
-
Run
npm run build
-
Run
npm run compile
-
Run the extension in Debug and Run mode by selecting
Run Extension
or pressingF5
in Visual Studio Code.Alternatively, build a
.vsix
file and install the extension to Visual Studio Code with the command palette or Extensions activity bar.- Run
vsce package
to generate theliberty-tools-vscode-xxx.vsix
file - Install the extension with the command palette:
- Select
Extensions: Install from VSIX...
and choose the generatedliberty-tools-vscode-xxx.vsix
file
- Select
- Install the extension with the Extensions activity bar:
- Navigate to the Extensions activity bar, or use the shortcut
Ctrl
-Shift
-X
- Click the
...
dropdown menu and selectInstall from VSIX
and choose the generatedliberty-tools-vscode-xxx.vsix
file
- Navigate to the Extensions activity bar, or use the shortcut
- Run
Step 5 downloads the JARs for Liberty Config Language Server and Eclipse LSP4Jakarta that are consumed by the VS Code client. If you would like a different version of the language servers other than what is available to download, the following instructions explain how to build these JARs locally.
- Run
git clone https://github.com/OpenLiberty/liberty-language-server.git
Make sure the cloned repo is in the same parent dir asliberty-tools-vscode
- Run
npm run buildLcls
- Run steps 6 and 7 above
For more information on building Liberty Config Language Server, see the project documentation on GitHub. Note that there are prerequsites to building this project locally.
- Run
git clone https://github.com/eclipse/lsp4jakarta.git
Make sure the cloned repo is in the same parent dir asliberty-tools-vscode
- Run
npm run buildJakarta
- Run steps 6 and 7 above
For more information on building Eclipse LSP4Jakarta, see the project documentation on GitHub. Note that there are prerequisites to building this project locally.
When running the extension with locally built language servers, a debugger can be attached to the language server process. The debug ports are as follows:
- Liberty-LemminX:
1054
- Liberty Language Server:
8002
- Jakarta LS:
8003
With the liberty-language-server
project opened in VSCode, run Debug attach liberty-ls
or Debug attach liberty-lemminx
to attach the respective debugger to the running extension.
This follows Visual Studio Code extension standard: add localized strings in package.nls.{locale}.json
.
The default nls message file is package.nls.json
.
-
Add new messages in
locales/{locale}.json
file. If message has parameters, use curly brackets to enclose them:{0}
,{1}
... -
Add the following import statement in your source code:
import { localize } from "../util/i18nUtil";
-
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);