Crate monaco_vscode_server

Source
Expand description

monaco-vscode-server is a Rust crate for managing the VSCode server backend.

It provides functionalities to download, start, stop, and manage the VSCode server, which is used by monaco-vscode-api to provide a Monaco editor with VSCode services.

§Features

  • embed: Enables embedding the VSCode server binary directly into your application. When this feature is active, the server can be extracted and run without needing a separate download step at runtime, unless overridden.

§Quick Start

use monaco_vscode_server::{VscodeServerManager, ServerConfig};
 
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut manager = VscodeServerManager::new().await?;
    manager.ensure_server().await?; // Downloads if not present or embedded
    manager.start().await?;
 
    println!("Server is running at {}", manager.url());
    println!("Server info: {:?}", manager.info());
 
    // Keep the server running for a bit (e.g., in a real app, it runs until shutdown)
    tokio::time::sleep(tokio::time::Duration::from_secs(10)).await;
 
    manager.stop().await?;
    println!("Server stopped.");
 
    Ok(())
}

Structs§

ServerConfig
Configuration for the VSCode server instance.
ServerInfo
Holds information about the detected or embedded VSCode server.
TauriConfig
Configuration specific to using VscodeServerManager within a Tauri application.
TauriVscodeServer
A wrapper around VscodeServerManager tailored for use in Tauri applications.
VscodeServerManager
Manages the lifecycle of a VSCode server instance.

Enums§

Platform
Supported platforms for VSCode server
ServerError
Error type for the monaco-vscode-server crate.

Functions§

download_server
Downloads and extracts the VSCode server based on the provided ServerInfo.