Andromeda VS Code Extension
A VS Code extension that integrates the Andromeda Language Server for comprehensive JavaScript and TypeScript development support.
Features
- Real-time Diagnostics - Live error reporting with comprehensive linting rules
- Auto-completion - Context-aware completions for:
- Andromeda APIs (file system, environment, process operations)
- Web APIs (Canvas, Crypto, Performance, Storage, Timers)
- Console methods with rich descriptions
- Database operations (SQLite)
- Code Actions & Quick Fixes - Auto-fix capabilities for common issues
- Document Formatting - Built-in code formatting support
- Hover Information - Rich documentation and type information on hover
- Configurable Diagnostics - Run on type, save, or never
- Multiple File Format Support -
.js, .jsx, .ts, .tsx, .mjs, .cjs
- Advanced Linting Rules including:
- Empty statement detection
- Variable usage validation
- Unreachable code detection
- Camelcase naming enforcement
- Console usage warnings
- Debugger statement detection
- Type checking for TypeScript
- And many more...
Requirements
- Andromeda v0.1.0-draft14 or higher
- VS Code 1.74.0 or higher
Installation
From Source
- Clone this repository
- Run
npm install to install dependencies
- Run
npm run compile to build the extension
- Press F5 to launch a new Extension Development Host window
Installing Andromeda
Make sure you have Andromeda installed:
Platform specific instructions:
Linux/Mac:
curl -fsSL https://tryandromeda.dev/install.sh | bash
Windows (PowerShell):
irm -Uri "https://tryandromeda.dev/install.ps1" | Invoke-Expression
Windows (CMD):
curl -L -o install.bat https://tryandromeda.dev/install.bat && install.bat
Install Andromeda using Cargo:
cargo install --git https://github.com/tryandromeda/andromeda andromeda
Install Andromeda using winget:
winget install --id Andromeda.Andromeda
Configuration
The extension can be configured through VS Code settings:
{
"andromeda.enable": true,
"andromeda.run": "onType",
"andromeda.configPath": null,
"andromeda.unusedDisableDirectives": "allow",
"andromeda.executablePath": "andromeda",
"andromeda.trace.server": "off",
"andromeda.format.enable": true,
"andromeda.codeAction.autoFix.enable": true,
"andromeda.completion.enable": true,
"andromeda.hover.enable": true
}
Settings Reference
Core Settings
andromeda.enable: Enable/disable the Andromeda language server
andromeda.run: When to run diagnostics (onType, onSave, never)
andromeda.configPath: Path to custom Andromeda configuration file
andromeda.unusedDisableDirectives: Handle unused disable directives (allow, warn, error)
andromeda.executablePath: Path to the Andromeda executable (default: andromeda)
andromeda.trace.server: Enable LSP communication tracing for debugging
Feature Settings
andromeda.format.enable: Enable code formatting (default: true)
andromeda.codeAction.autoFix.enable: Enable auto-fix code actions (default: true)
andromeda.completion.enable: Enable enhanced completions (default: true)
andromeda.hover.enable: Enable hover information (default: true)
Commands
Access these commands via the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
- Andromeda: Restart Language Server - Restart the language server
- Andromeda: Show Output - Show the language server output channel
- Andromeda: Apply Auto Fix - Apply auto-fixes for the current file
- Andromeda: Fix All Auto-fixable Problems - Fix all auto-fixable problems in the current file
- Andromeda: Format Document - Format the current document
Usage
- Install the extension and ensure Andromeda is in your PATH
- Open a JavaScript or TypeScript file
- The extension will automatically start the language server
- Enjoy real-time diagnostics, enhanced completions, and more!
Code Completion Examples
The extension provides rich completions for various APIs:
// Andromeda File System APIs
Andromeda.readTextFileSync| // Reads a text file synchronously
Andromeda.writeFileSync| // Writes binary data to a file
// Web APIs
crypto.subtle.digest| // Computes a digest of the given data
performance.now| // High-precision timing
localStorage.setItem| // Stores data in local storage
// Canvas APIs (when working with canvas)
ctx.fillRect| // Draws a filled rectangle
ctx.beginPath| // Begins a new path
Auto-Fix Examples
The extension can automatically fix common issues:
- Convert
var declarations to let or const
- Remove unused variables
- Fix camelCase naming issues
- Remove empty statements
- And more...
Supported File Types
- JavaScript:
.js, .mjs, .cjs
- JSX:
.jsx
- TypeScript:
.ts
- TSX:
.tsx
Troubleshooting
Language Server Not Starting
- Check Andromeda installation:
andromeda --version
- Check the Output panel: View → Output → "Andromeda Language Server"
- Restart the language server: Command Palette → "Andromeda: Restart Language Server"
- Check executable path: Ensure
andromeda.executablePath is correctly set
Diagnostics Not Appearing
- Check run mode: Verify your
andromeda.run setting
- File type support: Ensure the file type is supported
- Configuration conflicts: Check for conflicting configuration files
- Enable diagnostics: Ensure
andromeda.enable is set to true
Completions Not Working
- Feature enabled: Check
andromeda.completion.enable setting
- Trigger characters: Try typing
. after Andromeda, console, crypto, etc.
- Server status: Check if the language server is running properly
- Feature enabled: Check
andromeda.format.enable setting
- File saved: Ensure the file is saved before formatting
- Syntax errors: Fix any syntax errors that might prevent formatting
Development
Building
npm install
npm run compile
Debugging
- Open this folder in VS Code
- Press F5 to launch Extension Development Host
- Test the extension in the new window
- Check the Debug Console for any issues
Testing
npm run lint # Check for TypeScript issues
npm run watch # Watch for changes during development
Contributing
We welcome contributions! Please see the main Andromeda repository for contribution guidelines.
License
Mozilla Public License Version 2.0 - see LICENSE.md for details.
Links