Greengold Language Support for VS CodeThis official VS Code extension provides a full, first-class IDE experience for the Greengold (.gg) systems programming language. In addition to syntax highlighting and modern snippets, it provides an interactive Test Explorer, CodeLens inline actions, native debugging (DAP), build tasks & problem matchers, and a rich LSP (Language Server Protocol) server with real-time diagnostics, go to definition, find all references, symbol renaming, hover information, inlay hints, code completion, and automatic formatting. 🚀 Key Features1. Language Server Protocol (LSP) SupportThe extension automatically launches the Greengold LSP server (
2. 🧪 Interactive Test Explorer (
|
| Button / Command | Description |
|---|---|
Greengold: Run Current File $(play) |
Compiles and runs the active file with gg run. |
Greengold: Run Current File (Release) $(rocket) |
Runs the file with gg run --release. Bounds checks stay on. |
Greengold: Debug Current File $(debug-alt) |
gg build -g, then the native debugger. |
Greengold: Build Binary (Debug) $(tools) |
gg build. |
Greengold: Build Binary (Release) $(package) |
gg build --release. |
Greengold: Check Current File $(search) |
gg check. No codegen. |
Greengold: Apply Safe Fixes $(wrench) |
gg fix applies every verified safe fix. |
Greengold: Explain Diagnostic Code $(question) |
gg explain GG0301. |
Greengold: Format File $(paintcan) |
gg fmt: four spaces, else and elif level with if. |
Greengold: Run Tests $(beaker) |
gg test. |
Greengold: Create New Project $(new-folder) |
gg new. |
Greengold: Generate C Bindings $(plug) |
gg bindgen from a C header. |
Greengold: Generate C++ Bindings $(plug) |
gg bindgen --cpp writes the .gg file and a shim. |
Greengold: Generate Documentation $(book) |
gg doc from the # comment above each declaration. |
Greengold: Write API Lock $(lock) |
gg api --lock. |
Greengold: Check API Lock $(checklist) |
gg api --check. |
Greengold: List Targets $(list-flat) |
gg targets. |
Greengold: Emit LLVM IR $(circuit-board) |
gg emit-ll. |
Greengold: Emit LLVM Bitcode $(file-binary) |
gg emit-bc. |
Greengold: View AST $(symbol-structure) |
gg ast. |
Greengold: Restart Language Server $(sync) |
Restarts gg lsp. |
7. 🎨 Syntax Highlighting and Snippets
- Modules:
import std.math,import std.math as m,import std.math { sqrt },import "types.gg". Calls aremath.sqrtandtypes.Player. - Visibility: a line that is only
publicorprivate. The file starts public. - Variables:
x = 1can be changed later;fixed x = 1never changes. - Declarations & Implementations:
impl Struct:,impl types.Player:, and genericimpl Box[T]:typealiases:type ID = u32,type Matrix = [4]f64featuredeclarations:feature Printable:struct,extern struct,packed struct,align(N) struct, andunionenumdeclarations:enum Color:,enum Result[T, E]:fn,hot fn, andcomptime fn. Methods live inimpl Type:, notfn Type.methodstatic NAME: T = exprandallocator alloc, resize, free
- Standard library concurrency (
import std.thread):thread.Thread.spawn,thread.Thread.spawn_with_paramthread.Channel.new(),.send(),.recv(),.close()thread.Mutex.new(),.lock(),.unlock()thread.AtomicI64.new()
- Pattern Matching & Control Flow:
if let Valid(x) = opt: ... else: ...while let Valid(x) = iter.next(): ...- Statement & expression forms (
=>inline matches) match consume x:,match lend x:require cond
- Integer overflow:
overflow: wrap,overflow: trap,wrapping:blocks, and infixwrapping_add/saturating_add/checked_add(andsub/mul) - Loops:
for i in 0..n:,for i in range(n):,stepwith a literal or expression - Layout and ownership:
exclusive,soa,copy,dyn Feature,send,Arc,Shared - Rejected forms are marked invalid:
//,else if,&&,||,!x,++,--,;,let x =,var,def/func/function,fn Type.method,impl Feature for Type, and tab characters - FFI and pointers:
*T,*mut T,weak extern,extern ... as name,addr,ptr_cast,asm,null.trustis only insideunsafe: - Unit Testing:
test name:blocks,require, andfn test_*():
⚙️ Configuration Settings
You can customize the following options via VS Code settings (Ctrl+, -> greengold):
{
// Enable or disable Greengold Language Server support
"greengold.languageServer.enable": true,
// Path to the `gg` executable. Blank: `gg` from PATH, then the installer's folder
"greengold.path": "",
// Only used when `gg` is not found: runs `python -m greengold` (pip or source install)
"greengold.pythonPath": "python",
// Debugger backend to use ("auto", "lldb", "cppvsdbg", "cppdbg")
"greengold.debug.debugger": "auto",
// Enable CodeLens annotations above main and test functions
"greengold.codeLens.enable": true,
// Enable native VS Code Test Explorer integration
"greengold.testing.enable": true,
// Optional custom LSP server startup command (`gg lsp` when empty)
"greengold.languageServer.command": "",
// .gg files use four spaces. A tab is a syntax error.
"[gg]": {
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.detectIndentation": false
}
}
💻 Platform Support
The extension is plain JavaScript with no native code, so it runs on Windows, macOS and Linux (x64 and ARM) and needs VS Code 1.91 or newer.
- The
ggcompiler is a separate install and must be present on each machine. The extension looks for it in thegreengold.pathsetting, then onPATH, then in the installer's folder (~/.greengold/bin/ggon macOS and Linux,%LOCALAPPDATA%\Greengold\bin\gg.exeon Windows). - Native debugging needs a debugger extension: CodeLLDB (
vadimcn.vscode-lldb, preferred) or C/C++ (ms-vscode.cpptools, which uses the Visual Studio debugger on Windows,lldbon macOS andgdbon Linux). Setgreengold.debug.debuggerto choose. On macOS, install the Xcode Command Line Tools.
📦 Installation
1. Install the compiler
The extension runs the gg command. Install it without Python from the
latest release (it also adds gg to PATH; restart VS Code afterwards).
If gg is somewhere else, set greengold.path.
2. Install the extension
Download greengold-vscode.vsix from the latest release, then:
code --install-extension greengold-vscode.vsix
or use Extensions → … → Install from VSIX.
Building the VSIX yourself
cd vscode-extension
npm ci
npx @vscode/vsce package
📄 License
This VS Code extension is licensed under the MIT License.