Skip to content

Commit 5b65c2c

Browse files
Put the State Machine tab next to Verification (#162)
## Description Stacked on #159; merge that first. Independent of #161. The tabs are now **Verification · State Machine · Context**. Verification and State Machine link to each other through **Show in state machine** and **View error**, so they now sit side by side. Context shows the variables at the cursor for any file and works fine at the end. The walkthrough steps and the README sentence that lists them follow the same order. ## Screenshots `E_OSS_A1_19_AccessKeyGenerator` from the C-stars proposal in building-examples-liquidjava. **Before** <img width="560" alt="Tabs: Verification, Context, State Machine" src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/tab-order/before.png" /> **After** <img width="560" alt="Tabs: Verification, State Machine, Context" src="https://raw.githubusercontent.com/liquid-java/vscode-liquidjava/pr-screenshots/tab-order/after.png" /> ## Tests - `npm run lint` and `npm run test:typecheck`: clean. - `npm run test:unit`: 90 passed. New test in `script.spec.ts` for the tab order. - `npm test` (VS Code): passed; the walkthrough test now expects the new step order. - Server `mvn test` and the local smoke test: passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9fc9be9 commit 5b65c2c

5 files changed

Lines changed: 17 additions & 11 deletions

File tree

‎client/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ A repository with LiquidJava examples is available at [liquidjava-examples](http
4040

4141
### Getting started in VS Code
4242

43-
The **Get Started with LiquidJava** walkthrough introduces LiquidJava and its interactive tutorial, includes copyable Maven/Gradle annotation dependencies, then explains verification and its status indicator, diagnostics, context, state machines, the Command Palette, and logs. It also links to the [interactive tutorial](https://liquid-java.github.io/liquidjava-interactive-tutorial/). It opens once on installation, following VS Code’s walkthrough preferences. You can dismiss it at any time and reopen it with **LiquidJava: Show Walkthrough** from the Command Palette or **LiquidJava: Show Commands**. VS Code saves its progress across workspaces.
43+
The **Get Started with LiquidJava** walkthrough introduces LiquidJava and its interactive tutorial, includes copyable Maven/Gradle annotation dependencies, then explains verification and its status indicator, diagnostics, state machines, context, the Command Palette, and logs. It also links to the [interactive tutorial](https://liquid-java.github.io/liquidjava-interactive-tutorial/). It opens once on installation, following VS Code’s walkthrough preferences. You can dismiss it at any time and reopen it with **LiquidJava: Show Walkthrough** from the Command Palette or **LiquidJava: Show Commands**. VS Code saves its progress across workspaces.
4444

4545
### What are Liquid Types?
4646

‎client/package.json‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,22 +227,22 @@
227227
]
228228
},
229229
{
230-
"id": "context",
231-
"title": "Inspect context",
232-
"description": "The **Context** tab shows **Variables**, **Aliases**, and **Ghosts** after verification. Expand or collapse each section.\nLocal variables are filtered by the cursor: only declarations before it and in enclosing scopes appear. Select a range to inspect declarations that overlap it; global variables are also included.\nClick a variable to reveal its source. Variables relevant to a nearby error are highlighted alongside the failing refinement.\n[Open LiquidJava view](command:liquidjava.showView)",
230+
"id": "stateMachine",
231+
"title": "Explore state machines",
232+
"description": "The **State Machine** tab shows object states and method transitions declared with ``@StateSet`` and ``@StateRefinement``.\nPan the diagram; use **Zoom In**, **Zoom Out**, **Reset Zoom**, and **Toggle Orientation** to inspect it.\nUse **Expand Conditions** or **Collapse Conditions** to show or hide preconditions and postconditions. **Copy Mermaid Source** copies the diagram definition.\nFrom a state error, choose **Show in state machine** to see the related states and call. The tab opens on the first state error of the file, keeps the one you choose, and follows the error at the cursor; step through several with the arrows, and use **View error** to go back to it.\n[Open LiquidJava view](command:liquidjava.showView)",
233233
"media": {
234-
"markdown": "media/walkthrough/context.md"
234+
"markdown": "media/walkthrough/state-machine.md"
235235
},
236236
"completionEvents": [
237237
"onStepSelected"
238238
]
239239
},
240240
{
241-
"id": "stateMachine",
242-
"title": "Explore state machines",
243-
"description": "The **State Machine** tab shows object states and method transitions declared with ``@StateSet`` and ``@StateRefinement``.\nPan the diagram; use **Zoom In**, **Zoom Out**, **Reset Zoom**, and **Toggle Orientation** to inspect it.\nUse **Expand Conditions** or **Collapse Conditions** to show or hide preconditions and postconditions. **Copy Mermaid Source** copies the diagram definition.\nFrom a state error, choose **Show in state machine** to see the related states and call. The tab opens on the first state error of the file, keeps the one you choose, and follows the error at the cursor; step through several with the arrows, and use **View error** to go back to it.\n[Open LiquidJava view](command:liquidjava.showView)",
241+
"id": "context",
242+
"title": "Inspect context",
243+
"description": "The **Context** tab shows **Variables**, **Aliases**, and **Ghosts** after verification. Expand or collapse each section.\nLocal variables are filtered by the cursor: only declarations before it and in enclosing scopes appear. Select a range to inspect declarations that overlap it; global variables are also included.\nClick a variable to reveal its source. Variables relevant to a nearby error are highlighted alongside the failing refinement.\n[Open LiquidJava view](command:liquidjava.showView)",
244244
"media": {
245-
"markdown": "media/walkthrough/state-machine.md"
245+
"markdown": "media/walkthrough/context.md"
246246
},
247247
"completionEvents": [
248248
"onStepSelected"

‎client/src/test/walkthrough.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ suite('LiquidJava walkthrough', () => {
2525
assert.ok(walkthrough);
2626
assert.equal(walkthrough.title, 'Get Started with LiquidJava');
2727
assert.deepEqual(walkthrough.steps.map((step: { id: string }) => step.id),
28-
['tutorial', 'annotations', 'verification', 'commands', 'diagnostics', 'context', 'stateMachine', 'logs']);
28+
['tutorial', 'annotations', 'verification', 'commands', 'diagnostics', 'stateMachine', 'context', 'logs']);
2929
assert.equal(walkthrough.steps[0].title, 'Learn LiquidJava');
3030
const commands = await vscode.commands.getCommands(true);
3131
assert.ok(commands.includes('liquidjava.showWalkthrough'));

‎client/src/webview/script.spec.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ describe('webview script', () => {
127127
receive({ type: 'status', status: diagnostics.some(d => d.category === 'error') ? 'failed' : 'passed' });
128128
}
129129

130+
it('puts the State Machine tab next to Verification, which link to each other', () => {
131+
showDiagnostics([]);
132+
133+
expect(Array.from(root.querySelectorAll('.nav-tab'), tab => tab.getAttribute('data-tab'))).toEqual(['diagnostics', 'fsm', 'context']);
134+
});
135+
130136
it('posts ready and renders the initial loading view', () => {
131137
expect(postMessage.mock.calls).toEqual([[{ type: 'ready' }]]);
132138
expect(root.querySelector('h2')?.textContent).toBe('Verification Pending');

‎client/src/webview/views/sections.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ export function renderNav(selectedTab: NavTab, stateErrorCount = 0): string {
141141
<nav>
142142
<ul>
143143
<li><button class="nav-tab ${selectedTab === 'diagnostics' ? 'selected' : ''}" data-tab="diagnostics">Verification</button></li>
144-
<li><button class="nav-tab ${selectedTab === 'context' ? 'selected' : ''}" data-tab="context">Context</button></li>
145144
<li><button class="nav-tab ${selectedTab === 'fsm' ? 'selected' : ''}" data-tab="fsm">State Machine${stateErrorBadge}</button></li>
145+
<li><button class="nav-tab ${selectedTab === 'context' ? 'selected' : ''}" data-tab="context">Context</button></li>
146146
</ul>
147147
</nav>
148148
`;

0 commit comments

Comments
 (0)