🧼 Clean Language Extension for VS Code / Cursor
The official Clean Language extension for Visual Studio Code and Cursor editors, providing comprehensive support for the Clean Language with integrated language server, cleanmanager support, and advanced development features.
Created by Ivan Pasco - Creator of Clean Language, Clean Language Extension, and Clean Language Manager.
🚀 Features
🎨 Rich Language Support
- Comprehensive syntax highlighting for all Clean Language features
- Intelligent autocompletion with built-in classes and methods
- Error detection and validation with helpful suggestions
- Hover documentation for functions, classes, and built-in methods
- Automatic tab configuration enforces tabs over spaces for Clean Language files
- Code formatting with proper tab-based indentation
- One-click compilation with
cln compile
- Direct execution with
cln run
- Built-in testing with
cln test
- Debug support with
cln debug
- Syntax validation with
cln validate
📦 Version Management
- Automatic cleanmanager integration for version switching
- Per-project version support via
.cleanmanager
files
- Visual version indicator in status bar
- Easy version installation and switching
🔧 Language Server Protocol (LSP)
- Real-time error detection with Clean Language-specific suggestions
- Smart completions for apply-blocks, built-in classes, and method chaining
- Type-aware assistance with precision modifiers (
integer:64
, number:32
)
- Tab-indentation enforcement and validation
📋 Requirements
Essential
- VS Code 1.74.0 or newer (or Cursor editor)
- cleanmanager - The Clean Language version manager
Optional
- Clean Language Compiler (managed automatically via cleanmanager)
🔧 Installation
From VS Code Marketplace
- Open VS Code/Cursor
- Go to Extensions (Ctrl+Shift+X)
- Search for "Clean Language"
- Click "Install"
For Cursor Users
Important: If you don't see the extension in Cursor's marketplace:
Install from VSIX file:
- Download the latest
.vsix
from GitHub Releases
- In Cursor: Extensions > "..." > "Install from VSIX"
- Select the downloaded
.vsix
file
Verify Installation:
- Check Extensions panel for "Clean Language"
- Open a
.cln
file to trigger activation
- Look for the Clean Language status bar item
Troubleshooting:
- Restart Cursor after installation
- Check Developer Console for any error messages
- Ensure you have Node.js 16+ installed
Manual Installation
# Clone the extension source
git clone https://github.com/Ivan-Pasco/clean-language-extension
cd clean-extension
# Install dependencies
npm install
# Build the extension
npm run compile
# Package the extension
npm run package
🏁 Quick Start
1. Install cleanmanager
If not already installed, the extension will prompt you to install cleanmanager:
# Via installation script
curl -sSL https://github.com/Ivan-Pasco/clean-language-compiler/releases/latest/download/install.sh | bash
# Or download from GitHub Releases
# Visit: https://github.com/Ivan-Pasco/clean-language-compiler/releases
2. Create a Clean Language file
Create a new file with .cln
extension:
// hello.cln
start()
print "Hello, Clean Language World!"
3. Run your code
- Quick run: Press
Ctrl+F5
(Cmd+F5 on Mac)
- Or click the ▶️ Run button in the editor title bar
- Or use Command Palette:
Clean Language: Run File
🎯 Clean Language Syntax Highlights
Apply-Blocks (Core Feature)
print:
"Hello"
"World"
42
println:
"This prints each item on a new line"
Functions Block
functions:
integer add(integer a, integer b)
return a + b
string greet(string name)
return "Hello, " + name + "!"
Class with Inheritance
class Rectangle is Shape
number width
number height
constructor(number x, number y, number width, number height)
base(x, y)
this.width = width
this.height = height
functions:
number getArea()
return this.width * this.height
Built-in Classes
// Math operations
number result = Math.sqrt(16)
number power = Math.pow(2, 8)
// String manipulation
string upper = String.toUpperCase("hello")
integer length = String.length("Clean Language")
// HTTP requests
string response = Http.get("https://api.example.com/data")
string postResult = Http.post("https://api.example.com", jsonData)
Type System with Precision
integer:32 smallInt = 100
integer:64 bigInt = 9223372036854775807
number:32 float = 3.14
number:64 double = 3.141592653589793
⚙️ Configuration
Extension Settings
{
"clean.compiler.path": "", // Custom compiler path (optional)
"clean.manager.path": "cleanmanager", // cleanmanager executable path
"clean.lsp.enabled": true, // Enable Language Server
"clean.lsp.debug": false, // Enable LSP debug logging
"clean.indentation.enforceTabsOverSpaces": true, // Auto-enforce tabs for .cln files
"clean.indentation.tabSize": 4, // Tab size for Clean Language files
"clean.terminal.integratedConsole": true // Use integrated terminal
}
Per-Project Version
Create a .cleanmanager
file in your project root:
1.2.3
The extension will automatically switch to this version when opening the project.
🎮 Commands
Command |
Shortcut |
Description |
Clean Language: Run File |
Ctrl+F5 |
Execute current Clean file |
Clean Language: Compile File |
Ctrl+Shift+B |
Compile current Clean file |
Clean Language: Test File |
Ctrl+Shift+T |
Run tests in current Clean file |
Clean Language: Debug File |
- |
Debug current Clean file |
Clean Language: Validate File |
- |
Validate syntax of current file |
Clean Language: Select Version |
- |
Choose active Clean Language version |
Clean Language: Install Version |
- |
Install new Clean Language version |
Clean Language: List Available |
- |
Show all available versions |
Clean Language: Run Doctor |
- |
Check Clean Language environment |
🧪 Language Server Features
Smart Completions
- Built-in class methods:
Math.
, String.
, List.
, Http.
, File.
- Apply-block patterns:
print:
, println:
, custom functions
- Type completions:
integer:64
, list<string>
, matrix<number>
- Keyword snippets:
functions:
, class
, constructor
, control flow
Error Detection
- Syntax validation: Real-time parsing with helpful error messages
- Indentation checking: Ensures proper tab-based formatting
- Type consistency: Validates type annotations and conversions
- Structure validation: Warns about missing
functions:
blocks
Documentation on Hover
- Built-in classes: Documentation for Math, String, List, Http, File
- Method signatures: Parameter types and return values
- Type information: Details about Clean Language types
📁 Project Structure
clean-extension/
├── package.json # Extension manifest with tab configuration
├── syntaxes/
│ └── clean.tmLanguage.json # Syntax highlighting rules
├── snippets/
│ └── clean.code-snippets # Code snippets
├── src/
│ ├── extension.ts # Main extension logic with LSP client
│ ├── cleanmanager.ts # cleanmanager integration
│ ├── commands.ts # Command implementations
│ └── statusbar.ts # Status bar management
└── README.md # This file
Note: The Language Server is now part of the Clean Language compiler and managed by cleanmanager.
🔨 Development
Building from Source
# Install Node.js dependencies
npm install
# Compile TypeScript
npm run compile
# Language Server is now part of the compiler - no separate build needed
# Run tests
npm test
# Package extension
npm run package
Running in Development
# Open in VS Code
code .
# Press F5 to launch Extension Development Host
# Make changes and reload with Ctrl+R
🤝 Contributing
We welcome contributions to the Clean Language extension! Please see our contributing guidelines and feel free to:
- Report bugs and request features
- Submit pull requests
- Improve documentation
- Share feedback and suggestions
📜 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
- Ivan Pasco - Creator of Clean Language, Clean Language Extension, and Clean Language Manager
- Clean Language community contributors
- VS Code extension development community
Enjoy coding in Clean Language! 🧼✨
For more information, visit: