Skip to content

Commit d977679

Browse files
authored
Add LSP Flag (#225)
1 parent 38d4dbc commit d977679

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ mvn exec:java -pl liquidjava-verifier -Dexec.mainClass="liquidjava.api.CommandLi
8585
If you're on Linux/macOS, you can use the `liquidjava` script (from the repository root) to simplify the process.
8686
The script recompiles the verifier only when local sources or Maven files have changed.
8787

88+
The LiquidJava verifier can be run from the command line with the following options:
89+
90+
| Option | Description |
91+
| --- | --- |
92+
| `<...paths>` | Paths (files or directories) to be verified by LiquidJava |
93+
| `-h`, `--help` | Show the help message with available options |
94+
| `-v`, `--version` | Show the current version of the verifier |
95+
| `-d`, `--debug` | Enable debug logging and skip expression simplification for troubleshooting |
96+
| `-lsp`, `--language-server` | Enable language server mode for editor support |
97+
8898
**Test a correct case**:
8999
```bash
90100
./liquidjava liquidjava-example/src/main/java/testSuite/CorrectSimpleAssignment.java

liquidjava-verifier/src/main/java/liquidjava/api/CommandLineArgs.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public class CommandLineArgs {
2222
@Option(names = { "-d", "--debug" }, description = "Enable debug mode for more detailed output")
2323
public boolean debugMode;
2424

25+
@Option(names = { "-lsp", "--language-server" }, description = "Enable language server mode for editor support")
26+
public boolean lspMode;
27+
2528
@Parameters(arity = "1..*", paramLabel = "<...paths>", description = "Paths to be verified by LiquidJava")
2629
public List<String> paths;
2730

liquidjava-verifier/src/main/java/liquidjava/processor/context/ContextHistory.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.Map;
66
import java.util.Set;
77

8+
import liquidjava.api.CommandLineLauncher;
89
import liquidjava.utils.Utils;
910
import spoon.reflect.cu.SourcePosition;
1011
import spoon.reflect.declaration.CtElement;
@@ -44,6 +45,9 @@ public void clearHistory() {
4445
}
4546

4647
public void saveContext(CtElement element, Context context) {
48+
if (!CommandLineLauncher.cmdArgs.lspMode)
49+
return;
50+
4751
String file = Utils.getFile(element);
4852
if (file == null)
4953
return;

0 commit comments

Comments
 (0)