Egret-lang for Visual Studio Code
Official VS Code language extension for Egret-lang.
This extension provides syntax highlighting and editor language configuration for
Egret-lang .eg source files.
Features
- Syntax highlighting for
.eg files.
- Language registration under
Egret-lang, Egret, egret-lang, and egret.
- Comment support for
// ... and /* ... */.
- Folding markers for
#if / #endif and @AI / @END blocks.
- Bracket and quote auto-closing.
- Default indentation style for Egret-lang files: 4 spaces.
The TextMate grammar covers the current stable Egret-lang syntax, including:
- Declarations:
module, use, const, type, enum, class, norm,
norm impl, func, extern func, builtin func, and async func.
- Class lifecycle methods:
init, dispose, and deinit.
- Control flow:
if, else, loop, break, skip, return, match,
defer, and dispose.
- Async and lazy syntax:
async, await, spawn, join, lazy, and force.
- Object and type syntax:
new, super, super<Base>, immut, optional
types, Future(T), Future(T, ErrCode), Lazy(T), and Type { field: value } field initializer expressions.
- Operators and literals:
=>, =>?, ?, ..., 0b..., 0o..., 0x...,
C strings c"...", and common escape sequences.
Installation From Marketplace
After publication, install it from VS Code:
- Open Extensions.
- Search for
egret-lang or egret.
- Install Egret-lang by publisher
egret-lang.
Local Development
Open this directory in VS Code:
cd tools/vs-egret-lang-ext
code .
Then press F5 to launch an Extension Development Host and open any .eg file.
Package Locally
Install vsce if needed:
npm install -g @vscode/vsce
Package the extension:
cd tools/vs-egret-lang-ext
vsce package
Install the generated .vsix locally:
code --install-extension egret-lang-0.1.0.vsix
Publish
Make sure the publisher in package.json exists in the Visual Studio
Marketplace and that you have a valid Personal Access Token configured.
cd tools/vs-egret-lang-ext
vsce publish
The extension is discoverable through the displayName, description, aliases,
and keywords fields in package.json, including egret-lang, egret, and
egret language.
Source of Grammar
The syntax grammar is based on the repository's Egret-lang grammar and the
existing local syntax package under:
tools/vs-syntax-highlight/
When the language syntax changes, update that source package first when
appropriate, then sync the grammar and language configuration into this
publishable extension.