{"_id":"@codincod/codemirror-lang-vala","_rev":"3-db93bc809e70c38242d9ccfd5d9fee2b","name":"@codincod/codemirror-lang-vala","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@codincod/codemirror-lang-vala","version":"0.1.0","keywords":["editor","code","vala","codemirror"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-vala@0.1.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"148e831ddfa3991474705bc3454f762711355d25","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-vala/-/codemirror-lang-vala-0.1.0.tgz","fileCount":12,"integrity":"sha512-dVlCafe6Wmp90ITaj2ld7+NU+losJCmHjEt9dRWRnaYvMKJwHM6KfrkyA8MwVyH7egjEKMR/IL9n7BRf0RcLKg==","signatures":[{"sig":"MEUCIQCvEDkAoiqfYKmURJIkD3ermNgukoNeckFg9RaKEK0dBAIgCxyJir7t7tOH4ht2UQRlf0ihlbcBlHDa/221uypoHpk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":346507},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"gitHead":"a1363c0c295552fbc14e073934948305d457db42","scripts":{"fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group parent","test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/vala.grammar -o src/parser.js && cm-buildhelper src/vala.ts","clock":"npm run build && node ../lezer-survey/src/cli.ts clock","harvest":"node ../lezer-survey/src/cli.ts harvest --ext vala,vapi --oracle \"./tools/vala-oracle.sh {}\" --reject \"error:\" --jobs 12","measure":"npm run build && node ../lezer-survey/src/cli.ts measure --group parent","prepare":"npm run build","build-debug":"lezer-generator src/vala.grammar --names -o src/parser.js && cm-buildhelper src/vala.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-vala","type":"git"},"_npmVersion":"11.6.2","description":"Vala language support for the CodeMirror code editor","directories":{},"sideEffects":false,"_nodeVersion":"25.0.0","dependencies":{"@lezer/lr":"^1.0.0","@lezer/common":"^1.0.0","@lezer/highlight":"^1.0.0","@codemirror/language":"^6.0.0","@codemirror/autocomplete":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.7.0","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-vala_0.1.0_1786663899349_0.7625187236207909","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@codincod/codemirror-lang-vala","version":"0.2.0","keywords":["editor","code","vala","codemirror"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-vala@0.2.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"ef1435412b811e8b3c8a728b41cb4a8a13af068d","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-vala/-/codemirror-lang-vala-0.2.0.tgz","fileCount":12,"integrity":"sha512-OftrzX5BfDGajgvwHKpanEoa4p9HdFUSWsQ9eIcgoAXRAWLKBygMBOHvKibCEicbqPu+OkRYMBYgm9yDAJsV5g==","signatures":[{"sig":"MEUCIQCgsphhypN4bzAxEb0z+/e3wcsBfA2lTZwn4bxVJyLIdwIgRmuQ+shQ88X3NXKa7gGAXcr6T4ZT/NQcd9tx0D3lF48=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":365418},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"gitHead":"cb5103a9c1bf081e4bce7906d6da5849fcd91f81","scripts":{"fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group parent","test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/vala.grammar -o src/parser.js && cm-buildhelper src/vala.ts","clock":"npm run build && node ../lezer-survey/src/cli.ts clock","harvest":"node ../lezer-survey/src/cli.ts harvest --ext vala,vapi --oracle \"./tools/vala-oracle.sh {}\" --reject \"error:\" --jobs 12","measure":"npm run build && node ../lezer-survey/src/cli.ts measure --group parent","prepare":"npm run build","build-debug":"lezer-generator src/vala.grammar --names -o src/parser.js && cm-buildhelper src/vala.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-vala","type":"git"},"_npmVersion":"11.6.2","description":"Vala language support for the CodeMirror code editor","directories":{},"sideEffects":false,"_nodeVersion":"25.0.0","dependencies":{"@lezer/lr":"^1.0.0","@lezer/common":"^1.0.0","@lezer/highlight":"^1.0.0","@codemirror/language":"^6.0.0","@codemirror/autocomplete":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.7.0","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-vala_0.2.0_1786666013839_0.7117060973788367","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@codincod/codemirror-lang-vala","version":"0.3.0","description":"Vala language support for the CodeMirror code editor","keywords":["editor","code","vala","codemirror"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","type":"module","main":"dist/index.cjs","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"module":"dist/index.js","types":"dist/index.d.ts","sideEffects":false,"scripts":{"build":"rm -rf dist && lezer-generator src/vala.grammar -o src/parser.js && cm-buildhelper src/vala.ts","build-debug":"lezer-generator src/vala.grammar --names -o src/parser.js && cm-buildhelper src/vala.ts","prepare":"npm run build","test":"npm run build && node --test \"test/*.test.ts\"","clock":"npm run build && node ../lezer-survey/src/cli.ts clock","fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group parent","measure":"npm run build && node ../lezer-survey/src/cli.ts measure --group parent","harvest":"node ../lezer-survey/src/cli.ts harvest --ext vala,vapi --oracle \"./tools/vala-oracle.sh {}\" --reject \"error:\" --jobs 12"},"dependencies":{"@codemirror/autocomplete":"^6.0.0","@codemirror/language":"^6.0.0","@lezer/common":"^1.0.0","@lezer/highlight":"^1.0.0","@lezer/lr":"^1.0.0"},"devDependencies":{"@codemirror/buildhelper":"^1.0.2","@lezer/generator":"^1.7.0","typescript":"^5.6.0"},"homepage":"https://codincod.com/","repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-vala"},"gitHead":"cb5103a9c1bf081e4bce7906d6da5849fcd91f81","_id":"@codincod/codemirror-lang-vala@0.3.0","_nodeVersion":"25.0.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-ZBpaGp+/BtNJIwbLpIQrWIhRxrnbXyf5fTggoaQGs1YrqfzesQL6Dtmds43Jzqm6Go5qj2Sqq0qqAToj/FCdYw==","shasum":"0d8f817ede7f2cfb3e667474d17d1ff23cf0b773","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-vala/-/codemirror-lang-vala-0.3.0.tgz","fileCount":12,"unpackedSize":365418,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD9hO6whk3ITiV9iquEvOwC4xT4s2sMiGfln5otcIbswgIgJ3BI/AcL/mx6W1kcbnlQ5m+Y/LaFLMVVGnkbeQgciWI="}]},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"directories":{},"maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/codemirror-lang-vala_0.3.0_1786761168090_0.12311892144865655"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-13T23:31:39.192Z","modified":"2026-08-15T02:32:48.451Z","0.1.0":"2026-08-13T23:31:39.497Z","0.2.0":"2026-08-14T00:06:54.004Z","0.3.0":"2026-08-15T02:32:48.264Z"},"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","homepage":"https://codincod.com/","keywords":["editor","code","vala","codemirror"],"repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-vala"},"description":"Vala language support for the CodeMirror code editor","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"readme":"# @codincod/codemirror-lang-vala\n\nThis package implements Vala language support for the\n[CodeMirror](https://codemirror.net/) code editor.\n\nVala had no Lezer grammar and no CodeMirror mode of its own. Editors that\ncoloured it at all handed it to something written for C#, which is the language\nVala is shaped like and is not: measured against real Vala, our C# grammar reads\n24.61% of it.\n\nWritten in part for [CodinCod](https://codincod.com/), a competitive coding\nplatform, where it colours the editor people solve puzzles in.\n\nThis code is released under an\n[MIT license](https://codeberg.org/reeven/codemirror-lang-vala/src/branch/master/LICENSE).\n\n## Usage\n\n```javascript\nimport {EditorView, basicSetup} from \"codemirror\"\nimport {vala} from \"@codincod/codemirror-lang-vala\"\n\nconst view = new EditorView({\n  parent: document.body,\n  extensions: [basicSetup, vala()],\n})\n```\n\n## What Vala has that C# does not\n\n`valac`'s own `valascanner.vala` and `valaparser.vala` settled every question\nthis grammar had, and these are the answers worth writing down.\n\n**A slash is a regex where an expression may begin.** Vala has regex literals,\n`/ab+c/imsxo`, and its scanner decides between one and a division by the token\nbefore the slash. Lezer needs no such list: it offers a token only where the\nparse can shift one, so the pattern is offered where a value may start and the\noperator where an operator may.\n\n**A dollar reaches out of a string.** `@\"a $b c $(d.e)\"` is a template whose\nholes are Vala. The tokenizer cuts it into a start, its content, its holes and\nan end, and the grammar parses the expressions between the pieces. `@\"\"\"…\"\"\"`\nis the same thing over as many lines as it likes.\n\n**An ordinary string runs over a line break.** `\"a` on one line and `b\"` on the\nnext is one string, which is how the CSS and the XML that Vala programs carry\naround get written. C#'s does not, and reading Vala's the C# way was the single\nmost expensive mistake in this grammar's history.\n\n**Almost every keyword is also a name.** `file.delete ()`, `store.foreach (…)`,\n`new Variant.string (path)` and a property called `class` are all ordinary Vala.\nThe compiler's parser takes a keyword wherever a name is expected and nothing\nelse could follow, and leaving that out cost more of the corpus than anything\nelse did.\n\n**Ownership belongs to the type.** `owned`, `unowned`, `weak` and `dynamic` are\nwritten in front of a type wherever a type may be written, which is why they are\nnot in the modifier list: a member that took them as modifiers too would have no\nway to tell which of the two it had just read.\n\nThe rest, in one line each: signals, construct blocks, error domains,\n`requires` and `ensures` contracts, a constructor whose name carries a dot,\n`class Vala.CCodeComment` declaring into a namespace from outside it, slices\nopen at either end, arrays sized on the name rather than the type, structs built\nwith no `new` in front of them, and local functions.\n\n## A file may be a body\n\nVala has no top-level statements. What gets pasted into an editor is as often a\nloop lifted out of a method as it is a file, so a statement is read at the top\nof a file as well as a declaration, and the two readings stand side by side\nuntil something later tells them apart. A method written at the top of a file is\nstill a method: it is weighted over the local function of the same shape.\n\nA creation method and a destructor are the two members left out of that. Each\nbegins the way an expression begins, so each is read inside a type body only,\nwhich is the only place Vala allows either.\n\n## What it does not read\n\n`class` in front of a member, which a compact class writes instead of `static`.\nIt cannot join the modifier list, because a parser collecting modifiers would\nhave no way to tell the word that ends the list from the word that opens a\nclass, and every way around that cost far more ordinary Vala than the handful of\nbindings it would win.\n\nGenie, the indentation-based surface syntax `valac` also compiles, is a\ndifferent language written in `.gs` files and is not read here.\n\n## Measuring it\n\nThe grammar is measured against real Vala with\n[lezer-survey](https://codeberg.org/reeven/lezer-survey), which has to sit\nbeside this directory. The corpus is 30529 `.vala` and 1922 `.vapi` files taken\nfrom a thousand repositories, with every file checked by `valac` itself before\nit was kept. It reads 97.05% of the `.vala` files clean and 90.01% of the\n`.vapi` ones:\n\n```bash\nnpm run harvest -- ~/corpora/vala\nnpm run measure -- ~/corpora/vala\nnpm run gaps -- ~/corpora/vala\n```\n\n`tools/vala-oracle.sh` is what the harvest asks. `valac --fast-vapi` is the only\nmode that stops after the parse, so a program that uses Gtk without Gtk on the\npath still comes back clean and a program with a syntax error does not.\n","readmeFilename":"README.md"}