Skip to content

Editing a concept

Audience: language designers · ~8 min read · Prerequisites: The Language Editor

How the concept tabs behave while you work: new concepts, the Structure tab, rows of rules, completion and the Appearance tab's layout editor. What each tab holds is in Concept tabs, one by one.

New concept from a template

In the language's concept list, + New concept makes an empty concept and New from template… starts one with slots and a layout already in place: an expression with two operands, a statement with a condition and a body, or a declaration with a name and a value. In the Explorer, right-click a language's Concepts folder: Add new concept, or Add new concept: Expression…, Statement…, Declaration….

Every way asks for the name first. A name of several words gets a suggested alias, the initials of its words (whileLoop gets wl), which you can edit or clear. A template's slots are typed by interfaces (IExpression, IStatement), so a concept made from a template has no check errors.

The Structure tab

Declaration is the concept written as a declaration you edit in place. In order it holds: the head name, the parent class (Ctrl+Space lists the base class and the language's concepts) and the interfaces; the keywords abstract and rootable, shown only while set; the alias, display name (what the Inspector calls this kind of node), short, description, deprecated, icon and color lines (an unset line shows a dimmed none you click to type a value); and the slots, one line each.

icon is one glyph picked from a row of named glyphs or typed as any single character; color is a palette name or a hex colour such as #3b82f6 (mixed with the theme's text colour so it stays readable); none clears either; an invalid colour is reported, not saved.

  • Deleting a slot asks first only when code on another tab reads it; otherwise it goes at once, with an Undo line. If saved models of the open project hold a value in it, the line adds ⚠ 14 nodes in 3 models have a value in it; Migrate… on the language brings those models along.
  • Renaming a slot asks first. The dialog lists every aspect that reads it ("This changes: Appearance: 2 uses …") and how many mentions of the name it leaves alone (an object key, a string).
  • A Check: line flags a slot the class refers to but nothing declares (self.numeratr in an editor template), a type or interface the language does not know, and an interface implemented without a slot it requires.
  • Anything the view cannot edit (a value that is not a plain literal, a custom slot declaration) is listed as "Not editable here"; Edit as code shows the class text. What no aspect claims is under More.

Slot options

A slot's options beyond type and cardinality are the last cell of its line, as text: a flag is its name, a value is key=value, text with spaces is quoted (multiline default=5). A property accepts default, multiline, placeholder, label; a child slot default, multiline, label; a reference default and label. label is what a person calls the slot in a problem message: label="interest rate" makes a blank slot read "The interest rate is missing." Without one, a binary operator's operands read "left side of +" and "right side of +", and any other slot reads as its name in words. The change is written when you leave the cell; an unknown option or unreadable text is reported under the declaration and nothing is written.

Alt+Enter in the declaration offers Make abstract / Make concrete, Make this the file root / Not a file root and Implement INamedConcept. In the code views, keywords such as class, extends, return and if are read-only; to change the construct, replace the whole node (completion, Alt+Enter).

Rows of rules inside a tab

  • Root tabs. When an aspect holds several declarations (a method, a field), each is a tab in a row above the editor and only the open one is drawn. + lists the kinds the aspect can still add; × deletes the open one after asking. Rules are decorated methods (@check, @infer, @constraint) with a name nothing else uses; the decorator moves with the method. Arrow keys move between root tabs without opening them.
  • Inherited rules. A concept that extends another concept's class, or implements an interface, inherits its decorated rules. They show after its own as greyed tabs (announced "inherited from Base") and apply as they are. Override adds a root marked @override that calls super.name(ctx), extending the inherited rule instead of hiding it. A root that replaces an inherited one without @override, or an @override that replaces nothing, is named under the tabs. An interface's own rules are edited in the file.
  • Entry tabs. On Intentions, Rules > Constraints and Types > Checking rules, a hook returning a list of rules shows one rule per tab, with a line before them saying where you are (while › Intentions › Convert to if). The label is the rule's name and follows a rename. + adds a rule with a unique name; × (or Delete) removes the open rule without asking, with an Undo line. Editing one rule never touches the others. Refactorings and Migrations (@refactoring, @migration) are root tabs.

An aspect with nothing in it is not a tab: the … menu at the end of the tab bar creates it with a small working body (The Language Editor).

Completion

Ctrl+Space in a cell lists what fits. A type cell completes by any part of a name (Exp finds IExpression) and takes a single match at once. A property's type completes to string, number, boolean, name, code, then the language's enums; a child or reference type to interfaces and concepts. In the Types view the type cells complete to the engine's types and the language's own type names, and the else line's severity to error, warning, info.

The Appearance tab

On Inspector cell the layout is drawn as the Inspector draws it, with Section, Row, Field and Table pieces. The tab is a small studio: a palette on the left, the drawing of the layout in the middle (filled with a sample node) and a property panel on the right. The switch above picks Design, Code (the template's source) or Style sheet (your language's style classes); switching never rewrites the stored class.

  • Build the layout. Drag an item from the palette onto the drawing, or select a piece and press the item to add it after that piece (the search field narrows the list). A line shows the drop; Escape cancels. To move a piece, drag its grip (its left handle) or use Alt+arrows; Delete removes it. Right-click (or Shift+F10) opens the menu: move, new line, indent, Show this block only when…, Add a tooltip (the Tooltips button draws hover text as cards), typing, Show as code, delete. It wraps the line and its indented block (Include the next line and Release the last line adjust it); build the condition from blocks or code (this.flag); a strip shows what it gives on each sample. A text piece's words, its class and any CSS value (the ƒ on its row) can be queries too. Ctrl/Cmd+Z, Shift+Z and Y undo and redo in the layout.
  • The panel. Click a piece and the panel lists its Text (or slot, items, value), its Classes (chips plus a field that completes classes and looks from your style sheet; Save as a look… keeps the piece's styling; an undefined name is kept and listed under Problems with Open style sheet), its Properties and Quick styles. A property is a CSS name and value on one line: click the name to rename it, type any name (the list completes). A colour also offers theme colours and lighter, darker, fainter or mixed versions; hover its row for the contrast in both themes (under 4.5:1 is a problem). Resulting CSS shows the piece's own properties. With nothing selected the panel shows only the layout's problems. Resize the panel by its edge, or dock it below.
  • Sample. Empty, Typical and Everything draw the sample with every slot a placeholder, every required slot filled, or the optional parts and lists filled too.
  • Style sheet. The language's style sheet editor: a fixed set of safe properties, with a note for what it refuses. A piece's free-form Properties take any other CSS name.
  • Operator line. A concept that declares an operator (operator = { key, kind, precedence }) shows its key and an always-editable Precedence field. It names the pair and warns when the editor's operator order differs from the Text syntax's; only the order is compared.
  • Limits. A layout has no place for loose code: write a method on the concept (the More tab) and call it in a query, this.suppressLabel(). An editor with statements before its return stays in the TypeScript tab. Scenarios are not part of the studio.