4.2 Text editor

Every karpfen file and every environment descriptor opens in the text editor, one tab per file. The editor checks the text while you type and knows the names of the project, so it completes them, explains them and leads to their declarations. Keys are written for macOS first and for Windows and Linux second, as in Cmd+S / Ctrl+S.

4.2.1 Colours and marks#

The editor colours keywords, the action operations such as SET and DROPOBJ, strings, numbers, operators and comments. The names of attachable state machines, after STATEMACHINE, behaves after, ATTACH and as the second argument of EXCHANGE, have a colour of their own. Inside an EVAL block it colours the Python code on its own, with its keywords, strings, numbers and # comments, and marks the model paths $(...) and the macro references @name. A descriptor is coloured as JSON.

Errors and warnings get a wavy underline, infos a dotted one. The gutter shows the line numbers and a marker on each line with a problem. Resting the mouse on an underlined place shows the problem. Brackets and quotes are closed as you type them, and the bracket that matches the one at the caret is marked.

4.2.2 Completion#

Completion opens by itself after two letters of a word, after an opening quote, after $( and after ->. Complete Code opens it by hand: Ctrl+M on every system, with the Control key also on macOS, and on Windows also Ctrl+Space. The arrows and Page Up and Page Down choose an item, Enter, Tab or a double-click takes it, and Escape closes the list.

FileWhat completion proposes
KMetaThe type block at the top level. prop, has, knows and list in a type. number, string and boolean as the type of a property. The types of the file at the type of a relation, and in an event metamodel also the domain types. behaves after "…" after the description of a type, and the attachable state machines of the context inside its string, those attachable to the type first.
KModelThe make object block before the root object. prop, has and knows in an object. The properties and relations of the object's type inside prop(", has(" and knows(". The types at make object "key":", with the target type of the relation first. The keys of the objects of a fitting type after knows("relation") -> ".
KStatesThe keywords that fit the place, the action operations, IF IN SCOPE and WITH ... AS. The states inside the strings of a transition. The domain types after ATTACHED TO " and ATTACHABLE TO ". After STATEMACHINE the attached and the attachable header. ATTACH "…" after the parentheses of SETOBJ and APPENDOBJ. The attachable state machines of the context after ATTACH " and in the second argument of EXCHANGE(, those attachable to the type at that place first. The paths of the model in the strings of actions, VALUE, IF IN SCOPE and macro arguments, and after $( in EVAL. The events in the second argument of EVENT(, and the event domains used in the file. The macros inside MACRO(" and after @. CONTAINER STATE "…" USE "…" among the states and in a state, FINAL STATE "…" among the states, STATEMACHINE "…" FRAGMENT as a header and DONE in a condition. The fragments of the project after USE ", those of the context first, without the fragment of the file itself. The constructs of an optional language feature only while the feature is on.
DescriptorIn an empty file the descriptor with its required keys. The keys an object does not have yet, with their documentation. The files that fit a key, those next to the descriptor first. The object keys of the model at attachedTo, the fitting ones first. The event domains of the state machines. Typical values of tickDelayMs and eventTtlMs.

4.2.3 Hover#

Resting the mouse on a name shows what it is, and the problems at that place.

FileWhat hover shows
KMetaThe type, or a property with its type, such as prop maxWatts: number. The state machine after behaves after with its types.
KModelThe type of an object, a property or relation with its type, or an object with its key and type.
KStatesA state with its path, such as state on > full, a macro with its signature, the type a path leads to, or the type or event a name stands for. An attachable state machine with its types, such as state machine "glowing" attachable to Bulb. The fragment after USE with its file, such as fragment "bulb_test" in bulb_test.frag.kstates.
DescriptorWhat a key means, the role of a named file, the object behind attachedTo with its type, and an event domain.

4.2.4 Go to definition#

Go to Definition, Cmd+B / Ctrl+B or Cmd+click / Ctrl+click, leads from a name to its declaration, also in another file.

FromTo
The type after ATTACHED TO in a state machineThe type in the metamodel.
A state name in a transitionThe state. A state leads back to the places that name it.
A macro nameThe macro.
The name of a state machine after behaves after, ATTACH or in EXCHANGE(The attachable state machine, in its own file.
The name of a fragment after USEThe header of the fragment, in its own file. A fragment of the context of the file wins over one of another context.
An event name in EVENT(The event type in the event metamodel.
A segment of a model pathThe property or relation in the metamodel.
A type or a property or relation key in a modelIts declaration in the metamodel.
The target key of knows in a modelThe object with that key.
A file path in a descriptorThe file.
The value of attachedTo in a descriptorThe object in the model.

The IDE has no search for the places that use a name.

4.2.5 Outline#

The Outline tool window shows what the active file is made of, one row per element as name : detail, nested like the text. For a metamodel these are the types with their properties and relations, for a model the objects with their statements, and for a state machine the states with their entry and do blocks and inner states, the transitions, and the macros. An attachable state machine shows its name with its types as the detail. A fragment shows its header as a row of its own, bulb_test : FRAGMENT, above its states. A container state shows the fragment it uses as its detail, self test : USE bulb_test, and a final state reads passed : FINAL. A click on a row selects the element in the text.

4.2.6 Problems#

The status bar shows Problems at its left end. While the project has errors or warnings it reads Problems: N with the icon of the worst severity, and a click shows or hides the Problems tool window. The window hides itself when no problem is left.

The Problems tool window has two groups. Local holds what the editor finds while you type. Global holds what only a validation of the whole project finds, see 4.4 Validating. Before the first validation it reads Global (not validated yet). Below each group the problems are sorted by file, each file as path (N) and each problem as message (line:col). The chips Errors (N), Warnings (N) and Infos above the list show and hide each severity. A double-click or Enter on a problem leads to its place in the text.

The counts in the status bar are those of the group Local.

4.2.7 Find and replace#

Find… (Cmd+F / Ctrl+F) opens the find bar. Its toggles are Aa for Match Case, W for Whole Words and .* for Regular Expression. Enter or the next button goes to the next match, Shift+Enter or the previous button to the one before, and Escape closes the bar. Replace… (Cmd+R / Ctrl+R) opens the bar with a second field and the buttons Replace and Replace All.

Go to Line… (Cmd+L / Ctrl+G) opens a small field that shows Current line X of Y. Enter or Go moves the caret.

4.2.8 Saving and changes outside the IDE#

File > Save (Cmd+S / Ctrl+S) saves the active file, Save All (Cmd+Option+S / Ctrl+Alt+S) every file. A tab with unsaved changes asks before it closes, with Save, Don't Save and Cancel. A run saves every open file first.

When a file changes on disk while it is open without unsaved changes, the editor loads the new text as one change that Undo takes back. When the file has unsaved changes, a banner above the text reads <file> changed on disk while it has unsaved changes., with Reload and Keep mine. A file deleted on disk gets the banner <file> was deleted on disk., with Close and Keep mine. Saving over a file that changed on disk asks first, with Overwrite and Cancel.

4.2.9 Editing a descriptor#

A descriptor is edited as JSON text with the help of completion, hover and go to definition from the tables above. The editor checks the keys and the kinds of their values and that every named file exists and is of the right kind, see 4.1.2 Environment descriptors. A bridge file opens in a form instead, see 4.7 Bridges.

4.2.10 Keys#

Edit > Complete Code, Toggle Comment and Duplicate Line and Navigate > Go to Definition are in the menus as well. The context menu of the editor has Cut, Copy, Paste, Go to Definition and Toggle Comment.

ActionmacOSWindows and Linux
Complete CodeCtrl+MCtrl+M, on Windows also Ctrl+Space
Go to DefinitionCmd+B or Cmd+clickCtrl+B or Ctrl+click
Find, ReplaceCmd+F, Cmd+RCtrl+F, Ctrl+R
Find Next, Find PreviousCmd+G, Cmd+Shift+GF3, Shift+F3
Go to LineCmd+LCtrl+G
Toggle CommentCmd+/Ctrl+/
Duplicate LineCmd+DCtrl+D
Delete LineCmd+BackspaceCtrl+Y
Move Line Up, Move Line DownOption+Shift+Up, Option+Shift+DownAlt+Shift+Up, Alt+Shift+Down
Indent, OutdentTab, Shift+TabTab, Shift+Tab
Word left, word rightOption+Left, Option+RightCtrl+Left, Ctrl+Right
Start of line, end of lineHome, End, Cmd+Left, Cmd+RightHome, End
Start of file, end of fileCmd+Home, Cmd+End, Cmd+Up, Cmd+DownCtrl+Home, Ctrl+End
Delete the word before, afterOption+Backspace, Option+DeleteCtrl+Backspace, Ctrl+Delete
Select AllCmd+ACtrl+A
Cut, Copy, PasteCmd+X, Cmd+C, Cmd+VCtrl+X, Ctrl+C, Ctrl+V
Undo, RedoCmd+Z, Cmd+Shift+ZCtrl+Z, Ctrl+Shift+Z
Save, Save AllCmd+S, Cmd+Option+SCtrl+S, Ctrl+Alt+S
Close TabCmd+WCtrl+W
Open FolderCmd+OCtrl+O

Source: this page on GitHub at commit 3b6029f, refreshed 16 November 2026. The whole reference as a PDF.