interplane.Get Omega
Read in your language

vscode-omega

aien-dev/vscode-omega

Brought by drakestapleton

branch main Branches Tags History

vscode-omega / README.md

155 lines · 8544 bytes Raw Blame History Rendered
1# Omega for VS Code
2
3Syntax highlighting, snippets, and optional `omc` diagnostics and formatting for Omega (`.om`), the
4language of [aien-dev/omega-mv](https://github.com/aien-dev/omega-mv).
5
6[![extension](https://github.com/aien-dev/vscode-omega/actions/workflows/ci.yml/badge.svg)](https://github.com/aien-dev/vscode-omega/actions/workflows/ci.yml)
7
8**Connected repos:** [aien-dev/omega-mv](https://github.com/aien-dev/omega-mv) (the language and
9`omc`, pinned in [`omega.ref`](omega.ref)) ยท
10[aien-dev/tree-sitter-omega](https://github.com/aien-dev/tree-sitter-omega) (the tree-sitter grammar my
11TextMate grammar is checked against, pinned in [`tree-sitter-omega.ref`](tree-sitter-omega.ref)).
12
13## Install
14
15I publish each version as a GitHub Release with its sha256. Download `omega-<version>.vsix` and
16`omega-<version>.vsix.sha256` from the [Releases page](https://github.com/aien-dev/vscode-omega/releases), then:
17
18```sh
19sha256sum -c omega-0.1.0.vsix.sha256
20code --install-extension omega-0.1.0.vsix
21```
22
23Or build it yourself:
24
25```sh
26git clone https://github.com/aien-dev/vscode-omega && cd vscode-omega
27npm ci
28npx --no-install vsce package --no-dependencies -o omega-0.1.0.vsix
29```
30
31The extension is not on the Visual Studio Marketplace or Open VSX yet.
32
33## What it does
34
35- **Highlighting** for `.om` files: keywords, the OM-2 profile line, operator, type, contract and host
36 words, numbers (decimal, `0x` hex, floats), text with escapes, and `note` comments. Function and
37 declaration names keep their colour even when an OM-1 unit uses an OM-2 word such as `rotr` as a name.
38- **Snippets**: `fn`, `main`, `if`, `ife`, `while` (with its `bound`), `for`, `foru`, `struct`, `layout`,
39 `text`, `om2`, `note`. CI expands every snippet with its default values and compiles the result with `omc`.
40- **Comment toggling** (`note`), bracket matching and auto-closing for `(` `)` and `"`.
41- **Diagnostics from `omc`** on save (and the command *Omega: Check this file with omc*): the error
42 number and line `omc` reports, with the exact column for `om2 diag` units.
43- **Format Document** through `omc`'s own `om2 fmt` mode: blanks between words become one space, notes,
44 text and indentation stay as written; a unit `omc` refuses is left unchanged and gets its diagnostic.
45
46Diagnostics and formatting run only when the extension finds an `omc`: the `omega.omcPath` setting,
47else the first `omc` on `PATH`. Without one, the extension highlights and stays quiet.
48
49## Getting `omc`
50
51`omc` is a static AArch64 Linux program. On an AArch64 Linux machine:
52
53```sh
54git clone https://github.com/aien-dev/omega-mv && cd omega-mv
55sh seed/omega-from-seed.sh # writes seed/out/omc
56```
57
58then set `omega.omcPath` to the full path of `seed/out/omc`. The script births `omc` from a 408-byte
59seed. Its limits, in full: the 408 bytes are a binary written as 7,903 bytes of commented hex text
60and turned into bytes by a 1,048-byte POSIX shell script (load0.sh); the shell's printf is the one
61outside tool, and the chain runs only on AArch64 Linux. Matching the published `omc` hash is a
62fixed-output reproducibility match along one build path from a pinned commit (369dbc96); it is not
63diverse double compilation, does not prove omc correct, and off AArch64 Linux it reports NOT_RUN.
64
65On x86_64 Linux, macOS or Windows there is no native `omc`. On x86_64 Linux you can point
66`omega.omcPath` at a small wrapper script that runs `qemu-aarch64 /path/to/omc`; I have not tested
67that path.
68
69## Settings
70
71| setting | default | meaning |
72|---|---|---|
73| `omega.omcPath` | empty | path to `omc`; empty means the first `omc` on `PATH` |
74| `omega.diagnostics.onSave` | `true` | compile the file with `omc` on save and show its error |
75| `omega.omcTimeoutMs` | `10000` | stop `omc` after this many milliseconds |
76
77## How I test it
78
79All of this runs in CI on GitHub's `ubuntu-24.04-arm` runner, with `omc` born from the seed at
80`omega.ref`:
81
82- `npm test` (`test/omc.test.js`): the diagnostic parser, `omc` on accepted and refused units,
83 `om2 fmt` round trips, and every snippet compiled by `omc`.
84- `npm run test:vscode`: VS Code 1.90.0 (the oldest version the extension supports), under xvfb, with
85 this extension loaded. It checks that `.om` opens as Omega, that a refused unit gets the diagnostic
86 `omc error 16` on line 3 and an accepted one gets none, and that Format Document returns `om2 fmt`'s text.
87- `test/agree.js`: the TextMate grammar against
88 [tree-sitter-omega](https://github.com/aien-dev/tree-sitter-omega)'s highlight query, token by token,
89 over every `*.om` file in omega-mv and over [`test/fixtures/`](test/fixtures) (edge cases `omc`
90 accepts: names that start with `note`, `note(...)`, `note` inside text, a function named `field`
91 next to a `layout`). On the files `omc` accepts the two must agree on every token; CI fails otherwise.
92- Negative controls that must fail: the unit tests with a fake `omc` that accepts everything, the
93 VS Code test with that fake `omc`, the agreement check with the type words removed from the
94 TextMate grammar, and a package built without `.vscodeignore`, which must fail `test/check-vsix.sh`.
95
96MEASURED at omega-mv `e5b32567` with the TextMate grammar of this commit and the tree-sitter-omega
97commit in `tree-sitter-omega.ref` (local run on a DGX Spark, 2026-10-28; CI has not run on these
98commits yet):
99
100| files | tokens compared | TextMate and tree-sitter agree |
101|---|---:|---:|
102| 393 omega-mv files `omc` accepts | 118,468 | 118,468 (100%) |
103| all 811 omega-mv `*.om` files | 211,404 | 211,358 (99.978%) |
104| 3 files in `test/fixtures/` | 108 | 108 (100%) |
105
106The 46 disagreements are all in files `omc` refuses: malformed hex numbers, which the two grammars split
107differently, and deliberately malformed test fixtures.
108
109The same check over every public aien-dev repository with Omega in it (948 files `omc` accepts, in 17
110of the 26 repositories measured, omega-rosetta at its `corpus/200` commit `a5b7330a`; list and
111commits in tree-sitter-omega's README): 423,864 of 423,864 tokens agree. Over all 357 omega-rosetta
112files, exercise stubs and `test.om` files included, 100,651 of 100,651 agree. With the previous
113grammars (TextMate here at `885db1b`, tree-sitter-omega `9b63612`) it was 423,733 of 423,797 on the
114accepted files: a function named `field` outside a layout (aienos.com `om/hive-render/render.om`) and a
115`note` inside text (babel `build/babel.om`). With the previous grammars `test/fixtures/` agreed on 108
116of 117 tokens.
117`test/agree.js` now converts tree-sitter's byte columns to the editor's UTF-16 columns, so a line with
118a non-ASCII character no longer compares the wrong tokens.
119
120Not tested: the extension on Windows or macOS, the `qemu-aarch64` wrapper path, and VS Code versions
121other than 1.90.0.
122
123## Foreign dependencies
124
125These are editor and packaging glue, not part of Omega:
126
127| dependency | version | what it does here |
128|---|---|---|
129| VS Code extension API | engine `^1.90.0` | hosts the extension; `extension.js` and `omc.js` are plain JavaScript run by VS Code |
130| TextMate grammar format | n/a | `syntaxes/omega.tmLanguage.json`, read by VS Code's tokenizer |
131| @vscode/vsce | 4.0.0 | packages the `.vsix` (dev only) |
132| @vscode/test-electron | 3.1.0 | downloads VS Code 1.90.0 and runs the in-editor test (dev only) |
133| vscode-textmate, vscode-oniguruma | 9.3.2, 2.0.1 | run the TextMate grammar outside VS Code for `test/agree.js` (dev only) |
134| Node.js | 24 | runs the tests and vsce |
135| tree-sitter-cli | 0.27.1, via tree-sitter-omega | the other side of the agreement check (CI only) |
136
137An Omega-native editor protocol (a language server written in `.om`) would be the first-party
138replacement for `extension.js`; it does not exist yet.
139
140## Licence
141
142Apache-2.0 WITH LLVM-exception. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
143
144## Human-Directed Agentic Engineering
145
146Development follows Human-Directed Agentic Engineering (HDAE): humans define goals,
147architecture, constraints, acceptance criteria, and stopping points; agents implement,
148execute checks, diagnose failures, and revise within those boundaries. Human review
149retains responsibility for claims, acceptance, and release decisions. This describes
150the development method, not a change to runtime autonomy or historical evidence.
151
152For the documented method and a systems-software case study, see Gregory M. Kurtzer
153(2026), *Ginux: Building an Independent Kernel That Runs Linux Userspace through
154Human-Directed Agentic Engineering*, technical report, v1, Zenodo,
155<https://doi.org/10.5281/zenodo.23682548>.