10. The text surface
Contents of ATD 0.1
The surface of an editor (grammar/text.lark). EDSL is a placeholder, so this section is written from what the editors the hosts implement do: the five editors of the desktop host at its reference commit fe5feec, which port the standalone host's.
| Behaviour | Editor | Read in (etalii.adp.ide.desktop at fe5feec) |
|---|---|---|
| A buffer with one cursor and a selection; undo grouped word by word; movements by character, word, line and document; typed text, paste (CRLF made LF), copy, cut, Tab as four spaces | all | crates/adp-text/src/lib.rs 1-355, crates/adp-shell/src/editor.rs 253-320 |
| A line-number gutter, the current line marked, no soft wrap | all | crates/adp-shell/src/editor.rs 65-251 |
| Findings drawn as squiggles by severity, and listed in the problems panel at line and column (1-based, columns in characters) | all | crates/adp-shell/src/editor.rs 33-47, 196-213; crates/adp-shell/src/problems.rs 14-58 |
| Colouring by token classes, from the syntax of the file's extension (syntect's Sublime syntaxes), none above 20,000 lines | all | crates/adp-shell/src/highlight.rs 16-54 |
| Files opened: UTF-8 or ASCII, refused above 5 MB or when binary or not UTF-8; each line keeps its line ending, new lines take the dominant one; the byte-order mark is kept | all | crates/adp-documents/src/text.rs 1-124 |
Which editor opens a file: by its extension (md, markdown; json; xml, xsd; yaml, yml; anything else plain text) |
all | crates/adp-shell/src/documents.rs 21-85 |
| An outline of the ATX headings by level, outside fenced code | Markdown | modules/editors/markdown/src/lib.rs 16-48 |
| A preview beside the text: CommonMark with tables, strikethrough and task lists | Markdown | modules/editors/markdown/src/lib.rs 85-225 |
| Findings of a tolerant parser (fourteen messages, a duplicate key a warning) | JSON | modules/editors/json/src/parse.rs 93-396 |
Validation against the JSON Schema the root's $schema names, read from the project only |
JSON | modules/editors/json/src/lib.rs 1-273 |
Completion from that schema (property names not yet present, enum and const values) |
JSON | modules/editors/json/src/lib.rs 275-335 |
| Well-formedness, the declared encoding, and validation against the XSD or DTD the document names | XML | modules/editors/xml/src/lib.rs 1-306 |
Parser findings per document of a stream, tabs as indentation, duplicate keys, aliases, and validation against the schema a yaml-language-server comment names |
YAML | modules/editors/yaml/src/lib.rs 1-521 |
No editor folds, completes in the shell, offers quick fixes or opens links at the reference commit; the constructs below state those an editor type may declare, so that a description can state what an editor of its type does where hosts do it.
surface text { … } holds:
files "<glob>", …: the files the editor opens;tokens <syntax> { … }: the token classes come from the named syntax (markdown,json, …);token <class> { … }declares a class of its own, with itspattern(section 3.5) andscope;fold <Types> { … }: the element types of the text whose ranges fold;outline <Types> [by <attribute>] { … }: the element types the outline shows, nested by an attribute (a heading'slevel);complete from <source> { … }: a completion source, a capability (capability <name>) or a source the host names ("schema");check with <source> { … }: a check whose findings the editor shows, a capability or a named source ("schema","xsd");preview <source> { … }: an embedded preview, a capability of therenderextension point;fix <name> ["<label>"] { … }: a quick fix on a range, its statements actions on the text's model;- settings.
The text's model is the description's model: its element types are what the editor's binding reads from the text (headings, keys, elements). The origins of the five editor types are those of the desktop host's catalogue: editor/plain, editor/markdown, editor/json, editor/xml, editor/yaml.