Conversation
Signed-off-by: Federico Ponzi <me@fponzi.me>
Signed-off-by: Federico Ponzi <me@fponzi.me>
Signed-off-by: Federico Ponzi <me@fponzi.me>
…nprefixed .tla file exists on disk. If it does, that's used as the spec path Signed-off-by: Federico Ponzi <me@fponzi.me>
43bc543 to
ede9eed
Compare
Signed-off-by: Federico Ponzi <me@fponzi.me>
ede9eed to
08d7792
Compare
|
I've prototyped the ui on Figma. I mostly worked with Claude for the implementation. I've asked to generate a prompt that could be used to implement this feature, this is the result: Design doc for the feature# Model Editor — Specification Document This document is a precise specification of the TLA+ Model Editor feature for the VS Code TLA+ extension. It is detailed enough to rebuild the feature from scratch. Feature summaryEntry points
Model Overview tab
Spec Options tab
TLC Options tab
Model file generation
TLC integration
UX
Feature flagThe entire feature is gated behind
Entry points
ArchitectureFiles
Data flowMessage protocolWebview → Extension:
Extension → Webview:
Data modelModelEditorStateinterface ModelEditorState {
specName: string; // e.g. "Spec"
specPath: string; // absolute path to the .tla spec (not stored in marker)
modelName: string; // e.g. "MCSpec" — editable by user
behavior: ModelEditorBehavior;
checkDeadlock: boolean;
constants: ModelEditorConstantAssignment[];
invariants: string[];
properties: string[];
stateConstraint: string;
actionConstraint: string;
definitionOverrides: DefinitionOverride[];
additionalDefinitions: string;
symmetryConstants: string[]; // constant names with symmetry enabled
viewExpression: string; // VIEW cfg directive
alias: string; // ALIAS cfg directive
postCondition: string; // POSTCONDITION cfg directive
}TlcOptionsState (persisted in JSON state marker, passed as CLI args at runtime)interface TlcOptionsState {
checkingMode: 'bfs' | 'dfid' | 'simulate';
workers: number; // 0 = auto (all CPUs)
dfidDepth: number; // default 100
simulateTraces: number; // 0 = unlimited
simulateSeed: string; // empty = random
fpBits: number; // default 1 (TLC default)
enableProfiling: boolean;
}SerializationThe state marker JSON has the format MC.tla contains: MC.cfg contains: ParsingWhen opening existing files:
Discovery
cfg directive coverageAll TLC cfg directives are fully supported: INIT, NEXT, SPECIFICATION, CONSTANT(S), CONSTRAINT(S), ACTION_CONSTRAINT(S), INVARIANT(S), PROPERTY/PROPERTIES, CHECK_DEADLOCK, SYMMETRY, VIEW, ALIAS, POSTCONDITION. CONSTANTS block parsingWhen parsing a bare Definition overrides ( UI LayoutHeader section
Tab barThree tabs spanning the full width of the panel, each taking equal space ( Dirty tabs show a Model Overview tabAll section headings are uppercase (via BEHAVIOR SPEC
WHAT TO CHECK
WHAT IS THE MODEL (CONSTANTS)
Spec Options tabThree grouped sections:
TLC Options tabThree sections, each with uppercase heading:
TLC Options → CLI args conversionNote: VIEW, ALIAS, and POSTCONDITION are now cfg directives (written to the .cfg file), not CLI args. Important: Managed flags and conflict resolution
Reusable componentsInfoTipInline ⓘ icon with hover tooltip popover. Popover appears below the icon (not above, to avoid clipping at top edge), left-aligned. Uses DirtyFieldWraps any field. When dirty (value differs from saved state), shows a 3px left border in TextFieldText input with a custom suggestion dropdown (not native TextListFieldComma-separated input with suggestion chips below. Chips add values on click (if not already present). Accepts optional InitNextFieldsCollapsed summary when both Init and Next are populated: "Init = Init, Next = Next" with a "change" link. Expands to show two TextField inputs with suggestions. Defaults are auto-populated from discovery. ModelNameEditorShows TabBarRenders the three tab buttons (Model Overview, Spec Options, TLC Options) in a flex row with equal width. Each tab shows a TextAreaMulti-line NumberFieldNumeric input with label, optional ⓘ tooltip, and optional Dirty tracking
Spec switchingWhen the user opens the model editor for a different spec:
Tooltip textsEvery tooltip explains why the user would use the feature, with concrete examples. For instance:
Resource management
Styling approachAll styles are inline React
Section headings use Responsive designThe UI must work at any panel width, including very narrow side panels. Key rules:
Security
TestingTests in
Tests in
Toolbox parity statusFeatures at parity with the TLA+ Toolbox
Features not yet implemented
VS Code-exclusive features (not in Toolbox)
I don't plan to add any more features, the model editor currently works but I'd like to find opportunities to simplify the code. I'm also considering the idea of splitting in smaller PRs to ease the review. |
Adds a model editor similar to the one in the toolbox.
Fixes: #520 #159
Some features:
Model Overview tab:
Spec Options tab:
TLC Options tab: