Silk for Visual Studio Code
Language support for Silk .silk files.
Today the extension provides syntax highlighting, bracket matching, comment toggling, and
documentation-comment continuation. Language server features (diagnostics, hover, go to
definition, formatting) will come from the native Silk compiler.
Develop
bun install
bun run test # grammar assertions in test/grammar
bun run package # builds silk-<version>.vsix
Open this folder in VS Code and press F5 to launch an Extension Development Host with
the extension loaded. To install a build locally:
code --install-extension silk-0.0.1.vsix
Layout
| Path |
Contents |
icon.png |
Extension thumbnail for VS Code and Marketplace |
syntaxes/silk.tmLanguage.json |
TextMate grammar (source.silk) |
language-configuration.json |
Comments, brackets, auto-closing, indentation |
test/grammar/ |
vscode-tmgrammar-test scope assertions |
The extension is declarative for now. The language client will live in src/ with a main entry
in package.json that starts the native compiler's language server; the grammar and language
configuration stay as they are.
Grammar
The grammar follows the native lexer in
compiler/src/lexer: its keyword
set, // comments with /// item docs and //! module docs, text ("…", """…"""), raw
(r"…"), and byte (b"…") literals, character literals, lifetimes ('a), integer and float
literals in decimal, hex, octal, and binary, and duration literals such as 1h30m. When the lexer
changes, update the grammar and add an assertion under test/grammar/.
Import paths are highlighted as module paths, even when a segment shares a name with a
keyword or primitive type (for example, silk.effect or silk.bool). Names inside import
braces retain their normal highlighting.
License
MIT