Skip to content

Show the transition conditions on the state machine by default - #167

Merged
CatarinaGamboa merged 1 commit into
mainfrom
feat/fsm-conditions-open
Oct 26, 2026
Merged

CatarinaGamboa merged 1 commit into
mainfrom
feat/fsm-conditions-open

Conversation

@CatarinaGamboa

@CatarinaGamboa CatarinaGamboa commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

The pre and postconditions that state refinements carry besides the states (e.g. mode == 2 on setTilingMode) were hidden until the expand button was clicked, also when opening a state error, where they often explain why the call is rejected. The State Machine view now shows them right away, including on the transitions that stay bright when focusing on an error. The button still collapses them; opening another state error shows them again.

Before (collapsed by default) After (shown by default)

Screenshots from a headless VS Code on the ImageWriteParam study exercise (preview.setTiling() in startTiling): the bright setTilingMode arrow out of the actual state now says it only reaches tilingExplicit when mode == 2.

Changes

  • script.ts: showDiagramConditions starts true, and showStateError resets it to true instead of false.
  • script.spec.ts: the conditions are shown on first open, collapse with the button, and show again when opening a state error.

Testing

  • npm run test:unit (108 passed), tsc -p tsconfig.test.json, webpack build.
  • Checked in a headless VS Code with the extension (screenshots above).

🤖 Generated with Claude Code

The pre and postconditions besides the states were hidden until the
expand button was clicked, also when opening a state error, where they
often explain why the call is rejected. Show them right away; the button
still collapses them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CatarinaGamboa added a commit that referenced this pull request Oct 26, 2026
@CatarinaGamboa
CatarinaGamboa merged commit ca63ad2 into main Oct 26, 2026
3 checks passed
CatarinaGamboa added a commit that referenced this pull request Oct 27, 2026
The State Machine view described a state error in its own words:
"`x.m()` is rejected when `x` is in state A · allowed in state B", with
a legend of *Call rejected*, *Call allowed* and *Allowed, but not
reachable here* for the possible and accepted states. It now uses the
terms of a compiler error, as the Verification tab does (Expected /
Found):

- Summary: **Invalid method call `x.m()` · expected state `B` or `C` ·
actual state `A`**
- *expected* lists every state that accepts the call (before, only the
possible ones were listed, or all accepted ones when the state is
unknown); *actual* lists the states the receiver may be in, or
`unknown`.
- with several state sets, one group per set, joined with *and*:
`expected state tilingSet and compressionExplicit · actual state
startTiling and compressionExplicit`.
- when the error cannot be marked: *Invalid method call `x.m()`*, or
*Invalid method call at line N*.
- Legend: **✕ Actual state, not expected**, **✓ Actual state,
expected**, **Expected state** (the dashed outline). The marks on the
diagram are unchanged.

| Before | After |
|---|---|
| <img
src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/168/before.png"
width="440"> | <img
src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/168/after-tiling-state.png"
width="440"> |

Second error of the same file, `param.setCompressionQuality()`:

<img
src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/168/after-compression-state.png"
width="440">

The summary drops the receiver, which is already in the call.

## Testing
- `npm run test:unit` (107 passed), `tsc -p tsconfig.test.json`, webpack
build.
- Checked in a headless VS Code on the `ImageWriteParam` study exercise
(screenshots above).

Independent of #167 (shows the conditions by default); both touch the
State Machine view but not the same lines.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant