>_EXECUTIVE SUMMARY
vscode-stryke is the VS Code / VSCodium extension for stryke — a highly parallel Perl 5 superset interpreter written in Rust. It ships a declarative language contribution (filetype, grammar, editor config), an LSP client that launches stryke --lsp, and a TextMate grammar that is generated from the stryke binary's own reflection tables.
Design principle: the grammar is not a reskin of VS Code's built-in Perl grammar and not a hand-picked subset. scripts/gen_grammar.sh dumps %b (builtins), %k (keywords), and $c{parallel} from the live binary and emits a single source.stryke TextMate grammar carrying the complete language surface — all 10,450 builtins. Regenerate after a stryke upgrade and it stays in sync.
~COMPONENTS
| File | Responsibility |
|---|---|
package.json | Extension manifest — contributes.languages (id stryke, *.stk, shebang firstLine), contributes.grammars (source.stryke), contributes.configuration (LSP settings), and the vscode-languageclient dependency. |
language-configuration.json | Line comment #, brackets, auto-closing / surrounding pairs, word pattern, and brace-based indentationRules. |
extension.js | Activates on onLanguage:stryke and starts a LanguageClient running stryke --lsp over stdio. Missing binary → one non-fatal warning; highlighting still works. |
syntaxes/stryke.tmLanguage.json | Generated TextMate grammar — comments / POD, shebang, strings / here-docs / regex, numbers, sigil variables, keyword categories, all 10,450 builtins, types, and operators / thread macros. |
scripts/gen_grammar.sh | Regenerates the grammar from %b / %k / $c{parallel}. Builtin names are emitted longest-first so the alternation never matches a prefix of a longer name. |
scripts/tokenize_test.js | Loads the grammar under vscode-textmate + vscode-oniguruma (the engine VS Code itself uses) and asserts the scope of 10 sample tokens. |
$SCOPE MAP
| Token group | TextMate scope | Sample |
|---|---|---|
| Control flow | keyword.control.stryke | if unless loop match when try defer |
| Concurrency | keyword.other.concurrent.stryke | async await spawn |
| Declarations | storage.modifier.stryke | my var val const typed use package |
| Fn / type intro | storage.type.stryke | fn sub class trait struct enum impl |
| Phase hooks | keyword.other.phase.stryke | BEGIN END INIT CHECK UNITCHECK |
| Word operators | keyword.operator.word.stryke | and or not eq ne cmp x |
| Parallel builtins (39) | support.function.parallel.stryke | pmap pgrep pfor pchannel preduce fan |
| Builtins (10,450) | support.function.builtin.stryke | p say map reduce json_encode sha256 ai absorbance |
| Types | support.type.stryke | Int Str Float Bool Array Hash Map |
| Thread macros | keyword.operator.thread.stryke | ~> ~>> ->> |> |
| Literals & vars | string.* / constant.numeric / variable.* | strings, here-docs, regex, sigils, $_, numbers |
#VERIFICATION
The generated grammar is loaded under the exact engine VS Code uses at runtime — vscode-textmate driving vscode-oniguruma — and a sample is tokenized with the resulting scopes asserted. This proves the alternation (155 KB, 10,450 builtins) compiles under oniguruma and classifies tokens correctly, including builtins named after grammar reserved words such as contains and fold (a non-issue for TextMate regex, unlike Vim's :syntax keyword).
| Sample token | Asserted scope |
|---|---|
fn | storage.type.stryke |
say | support.function.builtin.stryke |
pmap | support.function.parallel.stryke |
absorbance (deep builtin) | support.function.builtin.stryke |
contains | support.function.builtin.stryke |
~> | keyword.operator.thread.stryke |