Supported Editors
Relevant source files
The following files were used as context for generating this wiki page:
vscli is designed as a versatile launcher for Visual Studio Code and its various distributions and forks. While the default behavior targets standard Visual Studio Code (code), the system is architected to support any editor that follows the command-line interface conventions established by VS Code, particularly regarding dev container URI handling.
Sources: README.md:9-11, src/launch.rs:88-90
Editor Configuration and Selection
The application allows users to specify which editor to launch through several mechanisms: CLI flags, environment variables, and history-based persistence. The primary data structure governing this is the Behavior struct.
The Behavior Structure
The Behavior struct encapsulates the necessary metadata to execute the editor command. It includes the executable name, launch strategy, and additional arguments.
pub struct Behavior {
pub strategy: ContainerStrategy,
pub args: Vec<OsString>,
#[serde(default = "default_editor_command")]
pub command: String,
}
Sources: src/launch.rs:64-70
Supported Editor Variants
The system explicitly recognizes several common VS Code distributions for display purposes, though it technically supports any command string provided by the user.
| Command | Display Name |
|---|---|
code | Visual Studio Code |
code-insiders | Visual Studio Code Insiders |
cursor | Cursor |
codium | VSCodium |
positron | Positron |
Sources: src/launch.rs:77-85, README.md:121-125
Architecture of Editor Execution
The execution flow involves resolving the user's desired editor, determining if a dev container is required, and then spawning the editor process.
Launch Logic Flow
The following diagram illustrates how the Setup component processes a launch request based on the selected editor and strategy.
Sources: src/launch.rs:114-159, src/main.rs:64-70
OS-Specific Execution
The editor is invoked differently depending on the host operating system. On Unix systems, the command is executed directly. On Windows, it is invoked via cmd /c to ensure compatibility with various installation methods (like .cmd or .bat wrappers common for VS Code).
- Unix:
Command::new(command).arg("-v")is used to verify existence before execution. - Windows:
Command::new("cmd").args(["/c", command])is used for the actual launch.
Sources: src/workspace.rs:271-295
Integration with Dev Containers
A core feature of the supported editors is their ability to open "Remote" sessions. vscli facilitates this by constructing a specific vscode-remote:// URI that the editors understand.
URI Construction
When an editor is launched in dev container mode, vscli does not pass a simple file path. Instead, it generates a hex-encoded JSON object containing the host path and the config file path, which is then passed via the --folder-uri flag.
Sources: src/workspace.rs:240-255
Configuration Options
Users can influence editor selection through the following LaunchArgs:
| Argument | Flag | Env Var | Description | Default |
|---|---|---|---|---|
command | -c, --command | COMMAND | The executable name of the editor. | code |
args | (positional) | ARGS | Extra flags passed directly to the editor. | [] |
Sources: src/opts.rs:36-50, src/launch.rs:72-74
Persistence in History
When an editor is used to open a workspace, the specific command used is saved in history.json. This allows the recent UI to re-launch the same project using the same editor distribution previously selected, unless explicitly overridden.
Sources: src/history.rs:25-36, src/main.rs:80-84
Summary
vscli treats the editor as a swappable component. While it provides specific formatting for "Visual Studio Code", "Cursor", and "VSCodium", the underlying architecture uses a generic command execution model. This ensures that as new forks of VS Code emerge, they can be utilized immediately by specifying their executable name in the --command argument.
Sources: src/launch.rs:77-86, README.md:20-22