VS Code Extension
The XXML VS Code extension provides full IDE support including syntax highlighting, diagnostics, code navigation, and ownership visualization.
Features
Syntax Highlighting
Full syntax highlighting for XXML source files (.XXML):
- Keywords (
Class,Method,Property,Instantiate, etc.) - Types and type parameters
- Ownership modifiers (
^,&,%) - Strings and comments
- Annotations (
@Derive,@Test, etc.)
Language Server Integration
Real-time IDE features powered by the XXML Language Server:
| Feature | Description |
|---|---|
| Diagnostics | Syntax and semantic errors as you type |
| Go to Definition | Jump to class, method, or property definitions |
| Hover Information | Type info and documentation on hover |
| Code Completion | IntelliSense for keywords and symbols |
| Find References | Find all usages of a symbol |
Ownership Visualization
Visual highlighting of ownership modifiers with distinct colors:
| Modifier | Color | Meaning |
|---|---|---|
^ | Green | Owned - Unique ownership, responsible for lifetime |
& | Blue | Reference - Borrowed, cannot outlive owner |
% | Orange | Copy - Independent bitwise copy |
Installation
From VSIX Package
- Build the extension package:bash
cd tools/vscode-xxml npm install npm run package - Install in VS Code:bash
code --install-extension xxml-language-0.1.0.vsix
For Development
- Install dependencies:bash
cd tools/vscode-xxml npm install - Compile TypeScript:bash
npm run compile - Press F5 in VS Code to launch the Extension Development Host.
Configuration
Access settings via File > Preferences > Settings and search for "XXML".
Available Settings
| Setting | Default | Description |
|---|---|---|
xxml.languageServer.path | "" | Path to xxml-lsp executable. Leave empty to search in PATH. |
xxml.languageServer.enabled | true | Enable/disable the language server |
xxml.ownershipVisualization.enabled | true | Show ownership modifier highlighting |
Example settings.json
{
"xxml.languageServer.path": "C:/path/to/xxml-lsp.exe",
"xxml.languageServer.enabled": true,
"xxml.ownershipVisualization.enabled": true
}Ownership Visualization
The extension highlights ownership modifiers inline to help visualize memory management:
Property <data> Types Integer^; // ^ highlighted in green
Method <process> Returns None Parameters (
Parameter <input> Types String& // & highlighted in blue
) Do { ... }Enabling/Disabling
Toggle via settings:
{
"xxml.ownershipVisualization.enabled": false
}Or use the command palette:
- Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Search for "XXML: Toggle Ownership Visualization"
Language Server
The XXML Language Server (xxml-lsp) provides IDE intelligence.
Note
LSP Capabilities
| Capability | Status |
|---|---|
textDocument/didOpen | Supported |
textDocument/didChange | Supported |
textDocument/didClose | Supported |
textDocument/completion | Supported |
textDocument/hover | Supported |
textDocument/definition | Supported |
textDocument/references | Supported |
textDocument/publishDiagnostics | Supported |
Building from Source
Build the Language Server
cd /path/to/XXMLCompiler
cmake --preset release
cmake --build --preset release --target xxml-lspThe server is built at build/release/bin/xxml-lsp.exe.
Build the VS Code Extension
cd tools/vscode-xxml
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Package as VSIX
npm run packageProject Structure
tools/vscode-xxml/
├── src/
│ └── extension.ts # Extension entry point
├── syntaxes/
│ └── xxml.tmLanguage.json # TextMate grammar for highlighting
├── language-configuration.json # Bracket matching, comments
├── package.json # Extension manifest
└── tsconfig.json # TypeScript configurationFile Associations
The extension automatically associates with .XXML files. To add additional patterns:
{
"files.associations": {
"*.xxml": "xxml",
"*.XXML": "xxml"
}
}Keyboard Shortcuts
| Shortcut | Action |
|---|---|
F12 | Go to Definition |
Shift+F12 | Find All References |
Ctrl+Space | Trigger Completion |
Ctrl+Shift+Space | Parameter Hints |
F2 | Rename Symbol |
Troubleshooting
"Language server not found"
- Verify
xxml-lsp.exeis in PATH or configurexxml.languageServer.path - Check the Output panel (View > Output > XXML Language Server)
"No diagnostics showing"
- Ensure
xxml.languageServer.enabledistrue - Check that the language server started successfully
- Look for errors in the Output panel
Known Limitations
- Rename not fully implemented - Rename across files may not work correctly
- No debugging support - The extension does not include a debug adapter
- Limited refactoring - Extract method/variable not supported
Next Steps
Learn about the CLI Reference for compiler options, or explore the Compiler Architecture for internals.