Repository navigation
Commit 69b6860
Label a named state set's diagram with its name (#178)
Brings
[liquidjava-fsm#17](liquid-java/liquidjava-fsm#17)
to the extension, for the verifier's named state sets and states written
as values of their sets (liquid-java/liquidjava#498, #510, #511; design
in liquid-java/liquidjava#502).
**Depends on a liquidjava-fsm 0.2.3 release** of liquidjava-fsm#17:
until it is on Maven Central, `server` does not build in CI.
## What changes
- `server/pom.xml`: liquidjava-fsm 0.2.2 → 0.2.3, which reads
`phase(this) == open`, `open == phase(this)` and `phase(this) != open`
in `from`/`to` as the states they name, and reports each diagram's
`stateSetName`.
- `StateMachineDTO`: passes `stateSetName` to the client (the
`liquidjava/fsm` request returns the fsm records, so it gets it as is).
- State Machine view: a named state set's diagram is titled with its
name, also when it is the class's only state set, so it can be matched
with the error message (`doorState(d) == closed`). A state set without a
name keeps its states as the title, as now.
## Checked, no change needed
The verifier sends the same shapes to the IDE as before (`git diff
fbc5e9f6 origin/main`): `StateErrorContext` still names states by their
names, and hints are unchanged. Only the text of a state error's
message, `expected` and `found` changes, to `doorState(d) == closed` for
named sets. The client renders those strings as they come, with the
generic highlighter, and nothing in the client parses state names out of
message text: the diagram marks and the summary line use `errorContext`.
The verification view shows the new form as is (last screenshot).
## Screenshots
Headless VS Code with this branch, liquidjava-fsm#17 installed locally
as 0.2.3 and the verifier built from liquid-java/liquidjava main, on
this spec (`d.lock(); d.open();` as the error):
```java
@stateset(name = "doorState", value = {"closed", "opened"})
@stateset(name = "lockState", value = {"unlocked", "locked"})
public class Door {
@StateRefinement(to = "doorState(this) == closed && lockState(this) == unlocked")
public Door() {}
@StateRefinement(from = "doorState(this) == closed && lockState(this) == unlocked", to = "doorState(this) == opened")
public void open() {}
@StateRefinement(from = "doorState(this) == opened", to = "doorState(this) == closed")
public void close() {}
@StateRefinement(from = "doorState(this) == closed && lockState(this) != locked", to = "lockState(this) == locked")
public void lock() {}
@StateRefinement(from = "lockState(this) == locked", to = "lockState(this) == unlocked")
public void unlock() {}
}
```
Before (main, fsm 0.2.2), the diagrams are wrong: `open` and `lock` go
from every state with the whole `from` as a condition, `close` and
`unlock` are missing, the summary only names `lockState`, and the titles
are the states. After, the diagrams match the spec, the conditions keep
the form the spec wrote, and the titles are the set names:
| | Before | After |
|---|---|---|
| Show all | <img
src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/178/before-all.png"
width="380"> | <img
src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/178/after-all.png"
width="380"> |
| Focus on error | <img
src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/178/before-focus.png"
width="380"> | <img
src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/178/after-focus.png"
width="380"> |
The verifier's message for the same error (no change here; shown for
context):
<img
src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/178/verification.png"
width="380">
## Not in this PR
- The verifier bump: main of liquid-java/liquidjava is not released yet.
When it is, `DiagnosticConverterTest` needs the new
`StateRefinementError` constructor argument (`display`, from #511) and
the `RefinementError` one (`aliases`); the server code itself compiles
against it.
- The walkthrough and README examples stay in the shorthand until the
extension ships a verifier that accepts named sets.
## Tests
- client: `vitest run` 124 passed (one new test, fails without the
change), typecheck and lint clean
- server: `mvn test` 35 passed, against liquidjava-fsm#17 installed as
0.2.3 in an isolated local Maven repository
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 123cda0 commit 69b6860
5 files changed
Lines changed: 24 additions & 7 deletions
File tree
- client/src
- types
- webview/views/fsm
- server/src
- main/java/dtos/fsm
- test/java/dtos/fsm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
328 | 337 | | |
329 | 338 | | |
330 | 339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | | - | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | | - | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
| 56 | + | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
0 commit comments