From c32b4e7a0f99f07a08658892d411dc315f6b6e30 Mon Sep 17 00:00:00 2001 From: Ricardo Costa Date: Thu, 25 Sep 2025 13:39:22 +0100 Subject: [PATCH 1/5] Update README --- .DS_Store | Bin 10244 -> 10244 bytes README.md | 120 ++++++++++++++++++++++----------- client/liquid-java-0.0.15.vsix | 4 +- client/src/extension.ts | 6 +- client/update.sh | 4 ++ install.bat | 55 +++++++++++++++ install.sh | 49 ++++++++++++++ 7 files changed, 196 insertions(+), 42 deletions(-) create mode 100644 client/update.sh create mode 100644 install.bat create mode 100755 install.sh diff --git a/.DS_Store b/.DS_Store index 7da168bc11b0d58d9a780c06c674cd984b52239c..ef8372a590b6decc92484522df431dcaffddeb09 100644 GIT binary patch delta 427 zcmZn(XbG6$mJU^hRb`s8^6a+9?Lb|$dA4!-?>fq{XAL60GwA(NpbH{Zo2DJMS( zD8>=cJMaEXm*bA8@+o-b3o;CYlk;;6Kzd&1HEebkT*=7DF!`;JEc5sL?9IHw>shrD z&AT@pbOM{p#*oaA1GG1lArE9X!fc3|$$4`K&g7GXN3ERwr{208#S11CcegDZn0gA0Q%kk*@QCV5B1$iP@f!NlCW zR!5=Q(#QbFHZz&5CglP2V!o6Ni(u!2jg$MOWZ05=+>&Y>CvTLJQ-?62zAXm&w1}Y$ WL?YWL*u7x$H>rgzo7olqvI77txp9a9 delta 302 zcmZn(XbG6$gHU^hRb^5l5}a+9?Lb|x@#f0n6WU|?Wj&|^qv$YdzV&3AE0%E?ax zigEa^$~kqx^tdCcd `Reload Window`) +7. The extension should activate within a few seconds +8. Click on the status indicator at the bottom left to view the logs + +## Development ### Developer Mode -1. Run **Client on Visual Studio Code**: -* Open the client folder on terminal -* `npm install` -* Open client folder on Visual Studio Code. -* Make sure you have the redhat extension for [Language support for Java ™](https://github.com/redhat-developer/vscode-java) installed and enabled. -* The code in `extension.ts` must be the same as the code in `extension_test.ts` -* Go to `Run-> Run Extension` (or press `F5`). A new window appears with the liquidjava extension enabled. -* Open a Java project. If the project contains the `liquid-java-api.jar` then the liquidjava verification will start in a few seconds. + +To run the extension in developer mode, which automatically spawns the server in a separate process: + +1. Open the `client` folder in VS Code +2. Run `npm install` +3. Make sure you have the Red Hat extension for [Language Support for Java™](https://github.com/redhat-developer/vscode-java) installed and enabled +4. Go to `Run` > `Run Extension` (or press `F5`) +5. A new VS Code instance will start with the LiquidJava extension enabled +6. Open a Java project containing the `liquid-java-api.jar` in the `lib` folder ### Debugging Mode -Server and Client connect through sockets and run in different environments that allow a better debugging -1. Run **Server** on **Eclipse**: -* Open Eclipse. -* Import the Maven project that is in the server folder. -* Run `App.java` with a port as argument. - -2. Run **Client** on **Visual Studio Code**: -* Open client folder on VSCode -* Copy all the code on file `extension-network.ts` to `extension.ts`. -* Go to Run-> Run Extension (or press F5). A new vscode appears to use the extension. - -#### Create Server Jar -When the server is ready to be exported, export the jar. In Eclipse follow the steps: -1. Inside eclipse make `File > Export > Runnable JAR file`. -2. In lauch configuration choose `main - vscode-liquid-java-server`. -3. In the output path choose the `client/server` folder of this extension. It should look like: `$USER$\vscode-liquidjava\client\server\language-server-liquidjava.jar` -4. The name of the jar must be `language-server-liquidjava.jar` for the client to be able to call it on Developer Mode. - -### Project -**Server** - implements an [LSP](https://microsoft.github.io/language-server-protocol/) in Java for the LiquidJava language, using the library [LSP4J](https://github.com/eclipse/lsp4j). - -**Client** - implements the vscode client for the LiquidJava Server. -The client depends on [Language support for Java ™ for Visual Studio Code](https://github.com/redhat-developer/vscode-java) to enable all the Java errors outside the scope of LiquidJava. + +To run the extension in debugging mode by manually starting the server and connecting the client to it: + +* Run the server: + - Open the `server` folder in your IDE + - Run `App.java`, which will start the server on port `50000` + - View the server logs in the console + +* Run the client: + - Open the `client` folder in VS Code + - Set the `DEBUG` variable to `true` in [`client/src/extension.ts`](./client/src/extension.ts) + - Go to `Run` > `Run Extension` (or press `F5`) + - A new VS Code instance will open with the LiquidJava extension enabled, which will connect to the server on port `50000` + - Open a Java project containing the `liquid-java-api.jar` in the `lib` folder + - View the client logs in the `LiquidJava` output channel or by clicking the status indicator + +### Create Server JAR + +To build the language server, export it as a runnable JAR file named `language-server-liquidjava.jar` and place it in `/client/server`. + +- In **Eclipse**: + - Open the `server` folder + - Select `File > Export > Runnable JAR file` + - In the launch configuration, choose `main - vscode-liquid-java-server` + - In the output path, choose the `/client/server` folder of this extension +- In **VS Code**: + - Open the `server` folder + - Use the Export Jar feature (`Ctrl+Shift+P` > `Java: Export Jar`) + - Select `App` as the main class + - Select `OK` + - Copy the generated JAR from the root directory to the `/client/server` folder +- In **IntelliJ**: + - Open the `server` folder + - Go to `File` > `Project Structure` > `Artifacts` + - Select `Add a new Jar` > `From modules with dependencies` + - Select `App` as the main class + - Build the artifact via `Build` > `Build Artifacts` > `Build` + - Copy the generated JAR from the `out/artifacts` folder to the `/client/server` folder + +### Project Structure +- `/server` - Implements the [Language Server Protocol (LSP)](https://microsoft.github.io/language-server-protocol/) in Java using the [LSP4J](https://github.com/eclipse/lsp4j) library +- `/client` - Implements the VS Code extension in TypeScript that connects to the language server using LSP + - It depends on [Language Support for Java™](https://github.com/redhat-developer/vscode-java) for regular Java errors +- `/lib` - Contains the `liquidjava-api.jar` required for the extension to be activated in a Java project \ No newline at end of file diff --git a/client/liquid-java-0.0.15.vsix b/client/liquid-java-0.0.15.vsix index d89745f..5d35ba3 100644 --- a/client/liquid-java-0.0.15.vsix +++ b/client/liquid-java-0.0.15.vsix @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e4d6dee0fda15be80ef0c083d665049636891513c5aae73eb9cf4469df6a5318 -size 209252904 +oid sha256:9b5e15df73e777dd7bc7332046df57b7188b2a7c07653be7c4cb29b6ca05fb6e +size 278 diff --git a/client/src/extension.ts b/client/src/extension.ts index 65b60e9..da1cf04 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -8,7 +8,9 @@ import { LanguageClient, LanguageClientOptions, StreamInfo, ServerOptions, State import { LiquidJavaLogger, createLogger } from "./logging"; const SERVER_JAR_FILENAME = "language-server-liquidjava.jar"; -const API_JAR_GLOB = "**/liquidjava-api*.jar"; +const API_JAR_GLOB= "lib/liquidjava-api*.jar"; +const DEBUG = false; +const DEBUG_PORT = 50000; let serverProcess: child_process.ChildProcess; let client: LanguageClient; @@ -64,7 +66,7 @@ export async function deactivate() { * @returns true if the extension can be activated, false otherwise */ async function isJarPresent(): Promise { - const uris = await vscode.workspace.findFiles(API_JAR_GLOB, null, 100); + const uris = await vscode.workspace.findFiles(API_JAR_GLOB); return uris.length > 0; } diff --git a/client/update.sh b/client/update.sh new file mode 100644 index 0000000..1845cd3 --- /dev/null +++ b/client/update.sh @@ -0,0 +1,4 @@ +#!/bin/bash +version="0.0.15" +vsce package +code --install-extension liquid-java-$version.vsix \ No newline at end of file diff --git a/install.bat b/install.bat new file mode 100644 index 0000000..4dc0303 --- /dev/null +++ b/install.bat @@ -0,0 +1,55 @@ +@echo off +setlocal enabledelayedexpansion + +set "version=0.0.15" + +:: Check if extension is already installed +code --list-extensions 2>nul | findstr "liquid-java" >nul 2>&1 +if %errorlevel% equ 0 ( + echo ✅ LiquidJava extension already installed! + exit /b 0 +) + +:: Setup script for LiquidJava development environment +echo 🚀 Starting LiquidJava development environment setup... + +:: Check if Git LFS is installed +git lfs version >nul 2>&1 +if %errorlevel% neq 0 ( + echo 📦 Git LFS not found. Please install Git LFS manually from https://git-lfs.github.io/ + echo After installing Git LFS, run: git lfs install + pause + exit /b 1 +) else ( + echo ✅ Git LFS already installed +) + +:: Pull LFS files +echo 🔄 Pulling Git LFS files... +git lfs pull + +:: Check if the VSIX file exists and is valid +set "vsix_path=.\client\extension\liquid-java-%version%.vsix" +if exist "%vsix_path%" ( + echo 🔍 VSIX file found, checking integrity... + for %%A in ("%vsix_path%") do set "file_size=%%~zA" + if !file_size! lss 1000 ( + echo ❌ VSIX file appears to be an LFS pointer file ^(too small^) + ) else ( + echo ✅ VSIX file appears to be valid ^(!file_size! bytes^) + ) +) else ( + echo ❌ VSIX file not found at %vsix_path% +) + +:: Install extension +echo 🔧 Installing LiquidJava VSCode extension... +code --install-extension "%vsix_path%" +if %errorlevel% equ 0 ( + echo ✅ Extension installed successfully +) else ( + echo ❌ Failed to install the extension +) + +echo 🎉 Installation complete! +pause \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..536cb1b --- /dev/null +++ b/install.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +version="0.0.15" + +# Check if extension is already installed +if code --list-extensions | grep -q "liquid-java" 2>/dev/null; then + echo "✅ LiquidJava extension already installed!" + exit 0 +fi + +# Setup script for LiquidJava development environment +echo "🚀 Starting LiquidJava development environment setup..." + +# Install Git LFS if not already installed +if ! command -v git-lfs &> /dev/null; then + echo "📦 Installing Git LFS..." + sudo apt-get update && sudo apt-get install -y git-lfs + git lfs install +else + echo "✅ Git LFS already installed" +fi + +# Pull LFS files +echo "🔄 Pulling Git LFS files..." +git lfs pull + +# Check if the VSIX file exists and is valid +if [ -f "./client/extension/liquid-java-$version.vsix" ]; then + echo "🔍 VSIX file found, checking integrity..." + file_size=$(stat -c%s "./client/extension/liquid-java-$version.vsix") + if [ "$file_size" -lt 1000 ]; then + echo "❌ VSIX file appears to be an LFS pointer file (too small)" + else + echo "✅ VSIX file appears to be valid ($file_size bytes)" + fi +else + echo "❌ VSIX file not found at ./extension/liquid-java-$version.vsix" +fi + +# Install extension +echo "🔧 Installing LiquidJava VSCode extension..." +code --install-extension ./client/extension/liquid-java-$version.vsix +if [ $? -eq 0 ]; then + echo "✅ Extension installed successfully" +else + echo "❌ Failed to install the extension" +fi + +echo "🎉 Installation complete!" \ No newline at end of file From df598222c4c8026d350bad9bfdbb4ac47a139a3b Mon Sep 17 00:00:00 2001 From: Ricardo Costa Date: Sun, 28 Sep 2025 10:21:39 +0100 Subject: [PATCH 2/5] Delete .DS_Store --- .DS_Store | Bin 10244 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index ef8372a590b6decc92484522df431dcaffddeb09..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10244 zcmeHMYitx%6h3DubanulmI6xwT`36EQc7tlPu;d#q(CjQg_f6PcV{RA)0w(6y9JTh zU`WJ*A@PxDB0l2thZsmyVj^l{BES4$8Y7@WV&o4d!ViOwD4u)ow4L2j3?@br<|Z@e z&OPVMJ@>ocnLBp|0I)8t&IbqsfJ6tA${0Fbr!YM`hLnKYGK(aVKR^;JFu{R1=tHdi z1|I<*0UrS$0UrS$fm;CqTC-V^MhoemeFS_2d;|s%V9$pz9ZW`C*&`%>bkK=!0Z8Ui zGcQ!9eE|0fyE5X+9wE6a-Bauy&~-(3i-E$O^kHUBGUCb}A%#1ja0hgIMt6sTym#^o zb92Cmkp9_6z(-&x0&MR-7Ro^d4Ki8#cavIDM#ubE((3FIj)C}%tvjt~G+|f?vXWW@ z2hSg<`l9xqJk*=?=-T0ph-Z5q#os|+92`%yd6#16E>PbCI&W-i4<9}MLX^km(GNy) zJ-w&jyh~;e-5T<#-wfCsHNwx+JJUvoT6kkPkw1V>&V4$q!AOR;^29?OaU4cbBnIK2 zv2QSqhLv>Zf+^WNlwae8Y5-ZbiEg{gwLO{WGIZOisQ4NKBl1R$%9rw`(bCq~4y!xn z#GSNV7f)?wS1p!hB>L;|#0FjKZdZ!xEz^nXrk3Ikx~h@MmR8+Vt?oK2ZK^i+jR}Pm zl!EO_Xz$*tn)zkn>dMM}W#PSxE32qpU9)drP?}IOZ|S=BT}G#AJ;kF2bRYl3+3eDr zJ0{gm8VQP#nPm;uJ56_AwRR2B+nIU+M&L?67~k}R5tK)VVnr=-yHc2;5jS@^x@FoM zw3JPgT$|FEzBOqX=}yybR|=AGBbhehj#g_JG5t}^ZgaHV4y$dlt&~&G z4cm0`Wo_+>lD4&V8ae10ElO^75gUo8VDQ+O3B`An%${3Wv#hqEv8iwD9peg?DUx09Nw>So6#g57lV?Yfo<7GPVj#f*1qeaao<#!j3R3bmyZ`Xg!G z*`t(55^tR{H6(9QsqZFBWnQZCz7*t|@YGOfGt<qeo9Cg=`mKncKYlzEJ34 z*7KUU?KF33CPj7H?Y@q5o9rF&l-Ar$6m(lxP%EDqYG+Ojs_t0*%2hOwjqG-{s>+AK zFbp+^9+H%=B$@=>%;-dWnq0wtsU%V==Aa}}Au2(7bD2y}f(WdHEtGp*um=voOK=q4 zg%98qd=6j288{2y!T0b3`~<(iRrnQt!vK!M0xZPwI2C8(94y5JxCocvQe1`&xC+-` z6F!KoxE0%R8^&=brqIDOX7F)*5_|Cw9>(YK4SWmV#&_@pevGH^6FiM)@f?1OKjP1L z8L!~)_y_)pe+3Exg@Gx786xCBe->@<@QJE{nRLod7CYlU83H@6mkh-##y@atB*U38 zZ0ZUM#}`ewljX$1rI7*p2)^}G%u8I()+~;5w(`u#p;;d#$>icG^0eX7Ydz6i+buD! zD*3`XEKiq+=E_KMIa8h`5y6#F;&bGyAH?sY|SNzI~1!du?ni{d$<_@jVLf1Qr~;aGZb{MXzlGzU-SR7p8@{ Date: Sun, 28 Sep 2025 16:20:44 +0100 Subject: [PATCH 3/5] Remove VSIX --- client/liquid-java-0.0.14.vsix | 3 --- client/liquid-java-0.0.15.vsix | 3 --- 2 files changed, 6 deletions(-) delete mode 100644 client/liquid-java-0.0.14.vsix delete mode 100644 client/liquid-java-0.0.15.vsix diff --git a/client/liquid-java-0.0.14.vsix b/client/liquid-java-0.0.14.vsix deleted file mode 100644 index 508bc81..0000000 --- a/client/liquid-java-0.0.14.vsix +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2d49572c9ff0f184694d8d0b1b95b05b3cd3566844906ac365359c7dcabfaded -size 65202517 diff --git a/client/liquid-java-0.0.15.vsix b/client/liquid-java-0.0.15.vsix deleted file mode 100644 index d340468..0000000 --- a/client/liquid-java-0.0.15.vsix +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9b5e15df73e777dd7bc7332046df57b7188b2a7c07653be7c4cb29b6ca05fb6e -size 278 \ No newline at end of file From 9505092f8e0d5860367ec4ac4af82a1503ba90e8 Mon Sep 17 00:00:00 2001 From: Ricardo Costa Date: Sun, 28 Sep 2025 16:24:47 +0100 Subject: [PATCH 4/5] Add VSIX --- client/liquid-java-0.0.15.vsix | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 client/liquid-java-0.0.15.vsix diff --git a/client/liquid-java-0.0.15.vsix b/client/liquid-java-0.0.15.vsix new file mode 100644 index 0000000..20c262b --- /dev/null +++ b/client/liquid-java-0.0.15.vsix @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c99792c43e9fdc8d6223e26464b86bbac339f7f34830ad2510b5c26cfd6e95b5 +size 72270316 From 689993ed25aba094d9613906a2a2d28451c225da Mon Sep 17 00:00:00 2001 From: Ricardo Costa Date: Sun, 19 Oct 2025 15:13:43 +0100 Subject: [PATCH 5/5] Add Dependency to README --- README.md | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a9930ca..a3074e2 100644 --- a/README.md +++ b/README.md @@ -16,19 +16,29 @@ The codespace will open in your browser and automatically install the LiquidJava [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/CatarinaGamboa/liquidjava-examples) -### Install Locally - -To install the extension on your local VS Code: -1. Clone this repository -2. Make sure you have [Git LFS](https://git-lfs.com/) installed to pull the VSIX installation file -3. Run the installation script: - - Linux/macOS: `./install.sh` - - Windows: `install.bat` -4. Open a Java project in VS Code -5. Copy the `lib` folder (containing the `liquidjava-api.jar` required for the extension to activate) into the root of your project -6. Reload VS Code (`Ctrl+Shift+P` > `Reload Window`) -7. The extension should activate within a few seconds -8. Click on the status indicator at the bottom left to view the logs +### Local Setup + +To set up the extension locally, install the [LiquidJava Extension](https://marketplace.visualstudio.com/items?itemName=AlcidesFonseca.liquid-java) from the VS Code Marketplace and add the `liquidjava-api` dependency to your Java project. + +#### Maven +```xml + + io.github.rcosta358 + liquidjava-api + 0.0.2 + +``` + +#### Gradle +```groovy +repositories { + mavenCentral() +} + +dependencies { + implementation 'io.github.rcosta358:liquidjava-api:0.0.2' +} +``` ## Development