Skip to content

Commit f194344

Browse files
committed
Merge remote-tracking branch 'origin/master'
Signed-off-by: Y <git@younes.io>
2 parents 5eef2b4 + 3be9fa7 commit f194344

File tree

15 files changed

+1773
-55
lines changed

15 files changed

+1773
-55
lines changed

languages/pluscal-snippets.json

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,44 @@
3535
],
3636
"description": "If block"
3737
},
38+
"Elsif": {
39+
"prefix": "elsif",
40+
"body": [
41+
"elsif ${1:condition} then",
42+
"\t${0:body}"
43+
],
44+
"description": "Elsif clause"
45+
},
46+
"Else": {
47+
"prefix": "else",
48+
"body": [
49+
"else",
50+
"\t${0:body}"
51+
],
52+
"description": "Else clause"
53+
},
3854
"If-Else": {
3955
"prefix": "ifel",
4056
"body": [
4157
"if ${1:condition} then",
4258
"\t${2:body}",
43-
"elseif",
59+
"else",
4460
"\t${0:body}",
4561
"end if;"
4662
],
4763
"description": "If-else block"
4864
},
65+
"If-Elsif": {
66+
"prefix": "ifelsif",
67+
"body": [
68+
"if ${1:condition} then",
69+
"\t${2:body}",
70+
"elsif ${3:condition} then",
71+
"\t${0:body}",
72+
"end if;"
73+
],
74+
"description": "If-elsif block"
75+
},
4976
"With": {
5077
"prefix": "with",
5178
"body": [
@@ -73,6 +100,16 @@
73100
"begin",
74101
"\t${0:body}",
75102
"end process;"
76-
]
103+
],
104+
"description": "Create new process"
105+
},
106+
"Procedure": {
107+
"prefix": "procedure",
108+
"body": [
109+
"procedure ${1:name}(${2:params}) begin",
110+
"\t${0:body}",
111+
"end procedure;"
112+
],
113+
"description": "Create new procedure"
77114
}
78115
}

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,12 @@
578578
"default": false,
579579
"markdownDescription": "Enable filesystem tools (list_directory, read_file, write_file) in the MCP server. These tools allow reading and writing files within the workspace. Restart VSCode to apply changes. It is unlikely that you will want to enable this, because VSCode and Cursor already provide filesystem operations."
580580
},
581+
"tlaplus.mcp.enableKnowledgeBaseTools": {
582+
"type": "boolean",
583+
"scope": "window",
584+
"default": false,
585+
"markdownDescription": "Enable the knowledge-base *tools* in the MCP server in addition to the knowledge-base *resources*. The two tools tlaplus_mcp_knowledge_list and tlaplus_mcp_knowledge_get allow you to search and read TLA+ knowledge-base articles as MCP tools. Restart VSCode to apply the changes. You’ll rarely need to enable this option, since both VSCode and Cursor already support MCP resources."
586+
},
581587
"tlaplus.pdf.convertCommand": {
582588
"default": "pdflatex",
583589
"type": "string",

resources/knowledgebase/tla-animations.md

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,18 @@ Legend == Group(<<
232232
("font-size" :> "12px" @@ "fill" :> "#666"))
233233
>>, <<>>)
234234
235+
\* Step number display
236+
StepNumber ==
237+
Text(90 + Cardinality(Nodes) * NodeSpacing, 190,
238+
"Step " \o ToString(TLCGet("level")),
239+
("text-anchor" :> "end" @@
240+
"font-size" :> "12px" @@
241+
"font-family" :> "monospace" @@
242+
"fill" :> "#666"))
243+
235244
\* Main animation view
236245
AnimView ==
237-
Group(<<Legend>> \o [i \in 1..Len(NodeSeq) |-> NodeVis(NodeSeq[i])], <<>>)
246+
Group(<<Legend, StepNumber>> \o [i \in 1..Len(NodeSeq) |-> NodeVis(NodeSeq[i])], <<>>)
238247
239248
\* TLC animation export
240249
AnimAlias ==
@@ -625,6 +634,32 @@ When creating TLA+ animations composed of multiple SVG frames, **it is essential
625634

626635
If the `viewBox` cannot be determined in advance, perform an initial pass to measure the maximum extents across all frames, then use those dimensions consistently for the final rendering.
627636

637+
### 6. Always Display Step Numbers
638+
639+
**Every animation frame must include a step number** to help track progression through the state space. The step number should appear in a consistent location across all frames, similar to how page numbers appear in documents.
640+
641+
```tla
642+
\* Add step number in bottom-right corner
643+
StepNumber ==
644+
Text(viewBoxWidth - 30, viewBoxHeight - 10,
645+
"Step " \o ToString(TLCGet("level")),
646+
("text-anchor" :> "end" @@
647+
"font-size" :> "12px" @@
648+
"font-family" :> "monospace" @@
649+
"fill" :> "#666"))
650+
651+
\* Include in your AnimView
652+
AnimView ==
653+
Group(<<YourMainVisualization, StepNumber>>, <<>>)
654+
```
655+
656+
**Best practices for step numbers:**
657+
- Position consistently (typically bottom-right or top-right corner)
658+
- Use monospace font for alignment
659+
- Choose subtle color that doesn't interfere with main content
660+
- Include "Step" prefix for clarity
661+
- Ensure adequate padding from frame edges
662+
628663
## Troubleshooting
629664

630665
### Common Issues and Solutions
@@ -859,7 +894,13 @@ Empty ==
859894
Image(13, 20, 140, 140, "assets/battery-empty-symbolic-svgrepo-com.svg",
860895
IF batteryLevel < 0 THEN <<>> ELSE [hidden |-> "true"])
861896
862-
AnimView == Group(<<Left, Right, Battery, Chargers, Empty>>, [i \in {} |-> {}])
897+
\* Step number in bottom-right corner
898+
StepNumber ==
899+
Text(220, 190, "Step " \o ToString(TLCGet("level")),
900+
("text-anchor" :> "end" @@ "font-size" :> "12px" @@
901+
"font-family" :> "monospace" @@ "fill" :> "#666"))
902+
903+
AnimView == Group(<<Left, Right, Battery, Chargers, Empty, StepNumber>>, [i \in {} |-> {}])
863904
864905
AnimAlias ==
865906
[left |-> left, right |-> right,
@@ -1011,8 +1052,14 @@ FlowArrows ==
10111052
"fill" :> "#6c757d"))
10121053
IN Group(<<arrow1, arrow2>>, <<>>)
10131054
1055+
\* Step number in bottom-right corner
1056+
StepNumber ==
1057+
Text(550, 340, "Step " \o ToString(TLCGet("level")),
1058+
("text-anchor" :> "end" @@ "font-size" :> "12px" @@
1059+
"font-family" :> "monospace" @@ "fill" :> "#666"))
1060+
10141061
AnimView ==
1015-
Group(<<ProducerLabel, BufferLabel, ConsumerLabel, BufferStatus, FlowArrows>> \o
1062+
Group(<<ProducerLabel, BufferLabel, ConsumerLabel, BufferStatus, FlowArrows, StepNumber>> \o
10161063
Prod \o Buffer \o Conss, <<>>)
10171064
10181065
AnimAlias ==
@@ -1412,5 +1459,6 @@ AnimAlias ==
14121459
5. **Layout Calculations**: Mathematical positioning for organized displays
14131460
6. **Grouped Elements**: Logical grouping of related visual components
14141461
7. **Text Overlays**: State information displayed as text labels
1462+
8. **Step Number Display**: Every frame includes `TLCGet("level")` for progression tracking
14151463

14161464
These examples demonstrate the full range of TLA+ animation capabilities, from simple state indicators to complex distributed system visualizations.

0 commit comments

Comments
 (0)