Zen-C Language Support
Full language support for Zen-C, a modern systems programming language that compiles to C.
Features
Syntax Highlighting
- Comprehensive syntax highlighting for all Zen-C language constructs
- Comment support (line and block comments)
- Build directive highlighting (
//> link:, //> include:, etc.)
- Attribute highlighting (
@derive, @must_use, @inline, etc.)
- String interpolation support with
{expression} syntax
- Smart bracket matching and auto-closing pairs
- Code folding support
Language Server (LSP)
- Go to Definition - Jump to function, struct, and variable definitions
- Find References - Find all usages of symbols
- Hover Information - View type information and documentation
- Code Completion - Intelligent completion for functions, methods, fields
- Diagnostics - Real-time syntax and semantic error checking
- Document Symbols - Outline view of file structure
- Signature Help - Parameter hints for function calls
Supported Language Features
Keywords
- Control flow:
if, else, match, for, while, loop, break, continue, return, defer, etc.
- Declarations:
fn, struct, enum, union, trait, impl, let, def, alias
- Special:
async, await, comptime, embed, asm, ref, autofree
Types
- Primitives:
int, uint, bool, char, string, void, byte
- Sized integers:
i8-i128, u8-u128, isize, usize
- Floating point:
f32, f64
Operators
- Pipeline:
|>
- Null coalescing:
??, ??=
- Safe navigation:
?.
- Try operator:
?
- Range operators:
.., ..<, ..=
Attributes
@derive, @must_use, @deprecated, @inline, @noinline, @packed, @align, @constructor, @destructor, @unused, @weak, @section, @noreturn, @pure, @cold, @hot, @export, @global, @device, @host, @comptime
Requirements
The Language Server requires the Zen-C compiler (zc) to be installed and available in your PATH.
Installing Zen-C
git clone https://github.com/z-libs/Zen-C.git
cd Zen-C
make
sudo make install
Installation
From Source
Install dependencies:
npm install
or
bun install
Compile the extension:
npm run compile
bun run compile
Copy this directory to your VS Code extensions folder:
- Linux/macOS:
~/.vscode/extensions/zen-c-0.1.0/
- Windows:
%USERPROFILE%\.vscode\extensions\zen-c-0.1.0\
Reload VS Code
From VSIX (if packaged)
code --install-extension zen-c-0.1.0.vsix
Usage
Files with .zc extension will automatically be recognized as Zen-C files and receive syntax highlighting and language server features.
Configuration
Install dependencies:
npm install
Compile TypeScript:
npm run compile
Package the extension:
npm install -g @vscode/vsce
vsce package
Example Settings
{
"zen-c.languageServer.enabled": true,
"zen-c.languageServer.path": "/usr/local/bin/zc",
"zen-c.trace.server": "verbose"
}
Example
import "std/io.zc"
@derive(Debug)
struct Point {
x: i32;
y: i32;
}
fn main() {
let p = Point { x: 10, y: 20 };
println "Point: {p.x}, {p.y}";
match p.x {
0..10 => println "Low",
10..=20 => println "Medium",
_ => println "High"
}
}
Building the Extension
To package this extension:
npm install -g @vscode/vsce
vsce package
Contributing
Contributions are welcome! Please submit issues and pull requests to the Zen-C repository.
License
MIT License - See the Zen-C project for details.
Links
| |