From 6969249e691ef2bb190ca2b1538da10b60e7d129 Mon Sep 17 00:00:00 2001 From: Ricardo Costa Date: Thu, 14 May 2026 15:11:12 +0100 Subject: [PATCH 1/2] Add LSP Flag --- .../src/main/java/liquidjava/api/CommandLineArgs.java | 3 +++ .../java/liquidjava/processor/context/ContextHistory.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/liquidjava-verifier/src/main/java/liquidjava/api/CommandLineArgs.java b/liquidjava-verifier/src/main/java/liquidjava/api/CommandLineArgs.java index fbc6e6d8..8fd36e37 100644 --- a/liquidjava-verifier/src/main/java/liquidjava/api/CommandLineArgs.java +++ b/liquidjava-verifier/src/main/java/liquidjava/api/CommandLineArgs.java @@ -22,6 +22,9 @@ public class CommandLineArgs { @Option(names = { "-d", "--debug" }, description = "Enable debug mode for more detailed output") public boolean debugMode; + @Option(names = { "-lsp", "--language-server" }, description = "Enable language server mode for editor support") + public boolean lspMode; + @Parameters(arity = "1..*", paramLabel = "<...paths>", description = "Paths to be verified by LiquidJava") public List paths; diff --git a/liquidjava-verifier/src/main/java/liquidjava/processor/context/ContextHistory.java b/liquidjava-verifier/src/main/java/liquidjava/processor/context/ContextHistory.java index 88b49687..6b9af787 100644 --- a/liquidjava-verifier/src/main/java/liquidjava/processor/context/ContextHistory.java +++ b/liquidjava-verifier/src/main/java/liquidjava/processor/context/ContextHistory.java @@ -5,6 +5,7 @@ import java.util.Map; import java.util.Set; +import liquidjava.api.CommandLineLauncher; import liquidjava.utils.Utils; import spoon.reflect.cu.SourcePosition; import spoon.reflect.declaration.CtElement; @@ -44,6 +45,9 @@ public void clearHistory() { } public void saveContext(CtElement element, Context context) { + if (!CommandLineLauncher.cmdArgs.lspMode) + return; + String file = Utils.getFile(element); if (file == null) return; From 73b4fb041d98a395b80025a826cad8fd334448a7 Mon Sep 17 00:00:00 2001 From: Ricardo Costa Date: Thu, 14 May 2026 16:23:58 +0100 Subject: [PATCH 2/2] Update README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index fab87e1d..c525f685 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,16 @@ mvn exec:java -pl liquidjava-verifier -Dexec.mainClass="liquidjava.api.CommandLi If you're on Linux/macOS, you can use the `liquidjava` script (from the repository root) to simplify the process. +The LiquidJava verifier can be run from the command line with the following options: + +| Option | Description | +| --- | --- | +| `<...paths>` | Paths (files or directories) to be verified by LiquidJava | +| `-h`, `--help` | Show the help message with available options | +| `-v`, `--version` | Show the current version of the verifier | +| `-d`, `--debug` | Enable debug logging and skip expression simplification for troubleshooting | +| `-lsp`, `--language-server` | Enable language server mode for editor support | + **Test a correct case**: ```bash ./liquidjava liquidjava-example/src/main/java/testSuite/CorrectSimpleAssignment.java