Skip to content

Latest commit

 

History

History
94 lines (65 loc) · 6.57 KB

DEVELOPING.md

File metadata and controls

94 lines (65 loc) · 6.57 KB

Developing Liberty Tools for IntelliJ IDEA

Note: Starting with the 0.0.8 early release, Java 17 (bundled with IntelliJ IDEA version 2022.2+) and a minimum version of IntelliJ IDEA version 2022.2 are required to run Liberty Tools for IntelliJ IDEA.

Building Liberty Tools for IntelliJ IDEA

This extension is built using the gradle-intellij-plugin.

  1. Clone this repository: git clone [email protected]:OpenLiberty/liberty-tools-intellij.git

  2. Import this repository as a Gradle project in IntelliJ IDEA

  3. Run ./gradlew runIde --stacktrace. A new IntelliJ IDEA window will launch with the Liberty Tools plugin installed to it. You can connect the IntelliJ IDEA debugger to this process to debug the plugin.

    OR

    Run ./gradlew buildPlugin to build an installable zip in build/distributions/liberty-tools-intellij-xxx.zip. You can install this zip in IntelliJ IDEA through Preferences > Plugins > Gear icon > Install Plugin from Disk... and select the liberty-tools-intellij-xxx.zip.

Language Servers

Liberty Tools for IntelliJ consumes the Liberty Config Language Server, Eclipse LSP4Jakarta, and Eclipse LSP4MP projects. The language server JARS are automatically downloaded from Maven Central and the Eclipse repository. The following instructions explain how to build these JARs locally and run them with Liberty Tools for IntelliJ IDEA.

Build Liberty Config Language Server locally

  1. Follow the Liberty Config Language Server build instructions to build the lemminx-liberty-x.x-SNAPSHOT.jar and liberty.ls-x.x-SNAPSHOT.jar.
  2. In the build.gradle file, update references to the liberty-langserver-lemminx and liberty-langserver to point to the versions built in the previous step.
  3. Until #173 is fixed, update the jar versions in io.openliberty.tools.intellij.liberty.lsp.LibertyXmlServer and io.openliberty.tools.intellij.liberty.lsp.LibertyConfigLanguageServer.

Debugging LemMinX Language Server

To debug the LemMinX Language Server in IntelliJ, complete the following steps.

  1. Start Liberty Tools for IntelliJ by creating an IntelliJ debug configuration for the ./gradlew runIde command.
  2. Create a new debug configuration: Remote JVM Debug --> specify localhost, port 1054 and command line arguments -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:1054
  3. In io.openliberty.tools.intellij.liberty.lsp.LibertyXmlServer.LibertyXmlServer() replace the line params.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1054,quiet=y"); with params.add("-agentlib:jdwp=transport=dt_socket,server=y,address=1054");.
  4. Start the debug configuration created in step 2. You can now step through the LemMinX LS code now with the IntelliJ debugger.

Build Eclipse LSP4Jakarta locally

  1. Follow the Eclipse LSP4Jakarta build instructions to build the org.eclipse.lsp4jakarta.ls-x.x.x-SNAPSHOT-jar-with-dependencies.jar. You do not need to build the lsp4jakarta.jdt or lsp4jakarta.eclipse components.
  2. In the build.gradle file, update references to the org.eclipse.lsp4jakarta.ls to point to the version built in the previous step.

Build Eclipse LSP4MP locally

  1. Follow the Eclipse LSP4MP build instructions to build the org.eclipse.lsp4mp.ls-x.x.x-SNAPSHOT-jar-with-dependencies.jar. You do not need to build the lsp4mp.jdt component.
  2. In the build.gradle file, update references to the org.eclipse.lsp4mp.ls to point to the version built in the previous step.

Monitoring language server messages

  1. Click the Language Servers tool window in the IntelliJ IDE to show the LSP Consoles.
  2. Select the language server you wish to monitor and then select Trace: messages or verbose.
  3. Messages to and from the language server will appear in the console, so you can verify the messages sent in response to user actions in the IDE.

For more information, see the LSP console user guide

Continuous Integration of LSP4IJ

For details on the Continuous Integration (CI) setup for LSP4IJ integration, refer to the LSP4IJ Continuous Integration documentation.

Localization

LibertyBundles.properties

Add localized strings in src/main/resources/messages/LibertyBundles_{locale}.properties. The default message file is LibertyBundles.properties.

Source code

  1. Add new messages in src/main/resources/messages/LibertyBunldes_{locale}.properties file. If message has parameters, use curly brackets to enclose them: {0}, {1}...

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

    import io.openliberty.tools.intellij.util.LocalizedResourceUtil;
  3. Call method LocalizedResourceUtil.getMessage to return localized message.

    Example without parameters:

    String message = LocalizedResourceUtil.getMessage("my.message.key");

    Example with parameters:

    String message = LocalizedResourceUtil.getMessage("my.message.key.with.params", param1, param2);

Test Videos

To record videos for all tests, not just the failed ones, you can create a video.properties file in the src/test/resources directory and add video.save.mode=ALL to that file.