VS Code Extension
Full-featured Language Server Protocol (LSP) support for Sruja DSL in VS Code.
VS Code Extension
The Sruja VS Code extension provides comprehensive language support for .sruja files with full LSP (Language Server Protocol) features powered by WebAssembly.
Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions (
Cmd+Shift+XorCtrl+Shift+X) - Search for “Sruja”
- Click Install on “Sruja DSL Language Support”
From VSIX File
- Download the
.vsixfile from GitHub Releases - In VS Code, go to Extensions
- Click the
...menu → “Install from VSIX…” - Select the downloaded
.vsixfile
Features
The extension provides a complete LSP implementation with the following features:
✨ Core LSP Features
1. Diagnostics (Errors & Warnings)
- Real-time error detection as you type
- Syntax errors highlighted immediately
- Validation errors (duplicate IDs, invalid references, etc.)
- Hover over errors to see detailed messages
2. Hover Information
- Hover over any symbol to see its definition
- Shows system/container/component information
- Displays labels and descriptions
Usage: Hover your mouse over any identifier
3. Autocomplete (IntelliSense)
- Keyword suggestions (
architecture,system,container, etc.) - Symbol completion (suggests existing systems, containers, components)
- Context-aware suggestions
Usage: Type Ctrl+Space (or Cmd+Space on Mac) to trigger autocomplete
4. Go to Definition
- Navigate to symbol definitions with
F12orCmd+Click - Works with qualified names (e.g.,
App.API) - Supports both root and child paths in FQNs
Usage:
F12- Go to definitionCmd+Click(Mac) orCtrl+Click(Windows/Linux) - Go to definitionCmd+F12- Go to implementation
5. Find All References
- Find all places where a symbol is used
- Shows references in relations and qualified names
- Opens in the References panel
Usage:
Shift+F12- Find all references- Right-click → “Find All References”
6. Rename Symbol
- Rename a symbol and all its references
- Updates both definitions and usages
- Handles qualified names correctly
Usage:
F2- Rename symbol- Right-click → “Rename Symbol”
7. Document Symbols (Outline)
- View all symbols in the current file
- Navigate quickly through your architecture
- Shows hierarchy: systems → containers → components
Usage:
Cmd+Shift+O(Mac) orCtrl+Shift+O(Windows/Linux) - Go to symbol in file- View → Outline
8. Workspace Symbols
- Search for symbols across all open files
- Quick navigation to any symbol in your workspace
Usage:
Cmd+T(Mac) orCtrl+T(Windows/Linux) - Go to symbol in workspace
9. Code Formatting
- Format your Sruja DSL code
- Consistent indentation and spacing
Usage:
Shift+Alt+F(Windows/Linux) orShift+Option+F(Mac) - Format document- Right-click → “Format Document”
🎨 Additional Features
Syntax Highlighting
- Color-coded keywords, strings, and identifiers
- Makes code easier to read and understand
Preview Architecture
- Generate visual previews of your architecture
- Opens in VS Code’s markdown preview
Usage:
- Right-click on a
.srujafile → “Preview Sruja Architecture” - Or use the command palette:
Cmd+Shift+P→ “Sruja: Preview Architecture”
Keyboard Shortcuts
| Feature | Mac | Windows/Linux |
|---|---|---|
| Go to Definition | F12 or Cmd+Click | F12 or Ctrl+Click |
| Find All References | Shift+F12 | Shift+F12 |
| Rename Symbol | F2 | F2 |
| Go to Symbol in File | Cmd+Shift+O | Ctrl+Shift+O |
| Go to Symbol in Workspace | Cmd+T | Ctrl+T |
| Format Document | Shift+Option+F | Shift+Alt+F |
| Trigger Autocomplete | Cmd+Space | Ctrl+Space |
Configuration
The extension supports the following settings:
Formatting Options
sruja.formatting.enabled(default:true) - Enable automatic formattingsruja.formatting.tabSize(default:2) - Number of spaces per indentation levelsruja.formatting.insertSpaces(default:true) - Use spaces instead of tabs
To configure:
- Open Settings (
Cmd+,orCtrl+,) - Search for “Sruja”
- Adjust the formatting options as needed
Debugging
If you encounter issues with the extension:
Check Output Channel
- Open Output panel:
View → Output - Select “Sruja WASM LSP” from the dropdown
- Check for error messages or initialization issues
Debug Command
- Open Command Palette:
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows/Linux) - Run: “Sruja: Debug WASM LSP”
- This will test all LSP functions and show results in the output channel
Common Issues
Extension not working?
- Check the “Sruja WASM LSP” output channel for errors
- Ensure WASM files are present (should be installed automatically)
- Try reloading the window:
Cmd+Shift+P→ “Developer: Reload Window”
LSP features not responding?
- Check if the file has a
.srujaextension - Verify the language mode is set to “Sruja” (bottom-right of VS Code)
- Run the debug command to see which functions are failing
Rename not working?
- Make sure you’re clicking on a valid symbol (not a keyword)
- Check the output channel for error messages
- Try the debug command to test rename functionality
Architecture
The extension uses WebAssembly (WASM) for all LSP functionality, which means:
- ✅ No CLI dependency - Works without installing the Sruja CLI
- ✅ Fast - WASM provides near-native performance
- ✅ Portable - Same code runs in browser and VS Code
- ✅ Self-contained - All functionality bundled in the extension
The LSP implementation is powered by the same Go codebase that runs the CLI, compiled to WASM for use in Node.js environments.
What’s Next?
- Learn the DSL: Check out the Syntax Reference
- See Examples: Browse Example Architectures
- Get Help: Join Discord or GitHub Discussions
Contributing
Found a bug or have a feature request?
- Report Issues: GitHub Issues
- Suggest Features: GitHub Discussions
- Contribute Code: See Contribution Guide