monaco-vscode-server
A Rust crate for managing VSCode server backend for applications using monaco-vscode-api.
Perfect for Tauri applications that need a VSCode-compatible backend for the Monaco editor.
Features
- 🔄 Automatic version matching - Always downloads the correct VSCode server version for your monaco-vscode-api
- 🚀 Simple API - Easy integration with Tauri or any Rust application
- 🌍 Cross-platform - Works on Windows, macOS, and Linux
- ⚡ Async/await - Built on Tokio for non-blocking operations
Installation
Add to your Cargo.toml:
[]
= "0.1.0" # Or the latest version
Quick Start
Basic Usage
use ;
async
Tauri Integration
In your Tauri app's main.rs:
use ;
use ;
// State type for the server
;
async
async
In your frontend (with monaco-vscode-api):
// Get server configuration from Tauri
const serverInfo = await ;
// Initialize monaco-vscode-api with the server URL
import from '@codingame/monaco-vscode-api';
await ;
Configuration
Custom Server Configuration
use ;
let config = ServerConfig ;
let manager = with_config.await?;
API Reference
VscodeServerManager
Main manager for the VSCode server.
new()- Create with default configurationwith_config(config)- Create with custom configurationensure_server()- Download server if neededstart()- Start the serverstop()- Stop the serveris_running()- Check if server is runningurl()- Get the server URLinfo()- Get server version information
TauriVscodeServer
Helper specifically for Tauri applications.
new(config)- Create new instanceinitialize()- Download and optionally start serverget_info()- Get info for frontendstop()- Stop the serverrestart()- Restart the server
Platform Support
| Platform | Architecture | Status |
|---|---|---|
| Windows | x86_64 | ✅ |
| macOS | x86_64 | ✅ |
| macOS | ARM64 | ✅ |
| Linux | x86_64 | ✅ |
| Linux | ARM64 | ✅ |
| Linux | ARMv7 | ✅ |
Server Storage
By default, servers are stored in:
- Linux/macOS:
~/.cache/monaco-vscode-server/ - Windows:
%LOCALAPPDATA%\monaco-vscode-server\
Override the server directory using the server_dir field in ServerConfig or by setting the VSCODE_SERVER_DIR environment variable.
Version Matching
The crate automatically:
- Queries the latest monaco-vscode-api release
- Reads its
package.jsonto find the VSCode commit - Downloads the exact matching server version
This ensures compatibility between monaco-vscode-api and the VSCode server.
Troubleshooting
Server fails to start
Check that the port isn't already in use. The default port is 8001. If you need to change it:
let config = ServerConfig ;
Download fails
The crate respects system proxy settings. For custom proxy:
Permission errors
Ensure the server directory is writable. Use a custom directory:
let config = ServerConfig ;
License
MIT - See LICENSE file for details.
Note: The VSCode server itself is subject to Microsoft's license terms.