Zen C for VS Code
A Visual Studio Code extension providing syntax highlighting and language support for the Zen C programming language.
Features
- Syntax highlighting for all Zen C language constructs
- Keyword highlighting (control flow, declarations, and special keywords)
- Type highlighting (primitive types, floating-point types, and standard types)
- String and character literal highlighting (including F-strings)
- Operator highlighting (arithmetic, comparison, logical, bitwise, and special operators)
- Comment support
- Preprocessor directive highlighting
- Attribute decorator highlighting
- Automatic bracket and quote closing
- Smart indentation
Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions (Ctrl+Shift+X or Cmd+Shift+X)
- Search for "Zen C"
- Click Install
From VSIX File
- Download the latest
.vsix file from the Releases page
- Open VS Code
- Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
- Select "Extensions: Install from VSIX..."
- Choose the downloaded
.vsix file
Development Mode
- Clone the Zen C repository
- Navigate to the
vscode-extension directory
- Run
npm install (requires Node.js)
- Press F5 to launch the extension development host
Language Support
Keywords
Control Flow:
if, else, match, for, while, loop, repeat, break, continue, return, guard, unless
Declarations:
fn, struct, enum, union, trait, impl, use, var, const, mut
Special:
defer, autofree, async, await, comptime, asm, volatile, test, assert, sizeof, and, or
Types
Primitive Types:
int, uint, I8, I16, I32, I64, I128, U8, U16, U32, U64, U128, isize, usize, byte
Floating-Point Types:
F32, F64
Other Types:
bool, char, string, void, U0
Standard Types:
Result, Option
Constants
true, false, null, self
Attributes
@must_use, @deprecated, @inline, @noinline, @packed, @align, @constructor, @destructor, @unused, @weak, @section, @noreturn, @derived
Operators
Arithmetic:
+, -, *, /, %
Comparison:
==, !=, <, >, <=, >=
Logical:
&&, ||, !
Bitwise:
&, |, ^, ~, <<, >>
Special:
??, ??=, ?., ?, .., ..., ->, =>, |>, ::
Strings
Regular Strings:
"Hello, World!"
Characters:
'a', '\n'
F-Strings:
f"Value: {x}"
Example
struct Point {
x: int,
y: int
}
fn add(a: int, b: int) -> int {
return a + b;
}
fn main() {
var p = Point { x: 10, y: 20 };
println(f"Point: ({p.x}, {p.y})");
match p.x {
10 => println("Ten"),
_ => println("Other")
}
}
File Extensions
.zc - Zen C source files
Development
Project Structure
vscode-extension/
├── package.json # Extension manifest
├── language-configuration.json # Language configuration
├── syntaxes/
│ └── zen-c.tmLanguage.json # TextMate grammar
└── README.md # Documentation
Building and Testing
# Install dependencies
npm install
# Package extension
npm run package
# Run in extension development host
F5
Contributing
Contributions are welcome. Please submit issues and pull requests to the Zen C repository.
License
MIT License
Links