vscode
This directory provides rich, native-feeling voice control for Visual Studio Code (and downstream distributions like Cursor, VSCodium, Windsurf, Azure Data Studio, and Positron). It implements this support by bridging Talon's standard action API with a high-performance RPC command server running inside VS Code.
Architectural Overview
Voice control for VS Code is split into three main layers:
- The Transport Layer (vscode_command_client.py): Handles sending commands to VS Code. It uses a file-based RPC command server (provided by the VS Code Talon extension pack) to instantly invoke VS Code commands. If the extension is not installed, it falls back to invoking actions by typing into the VS Code Command Palette.
- The Context and Action Map (vscode.py): Overrides standard Talon system actions (such as managing tabs, split editors, cursor controls, and find/replace functionality) and routes them through the transport layer using VS Code's internal action identifiers.
- The User Command Set (vscode.talon): Defines a comprehensive set of voice commands for panel management, file navigation, Git control, debugging, and language utilities.
Core Components
Command Routing and Fallbacks
The vscode_command_client.py file registers VS Code as a client capable of executing commands via Talon's command_client system.
It exposes actions such as:
* user.vscode(command_id): Asynchronously runs a VS Code internal command.
* user.vscode_and_wait(command_id): Synchronously runs a command and blocks until completion.
If the command server socket/directory is not found (which happens if the companion VS Code extension is missing), the script catches the NoFileServerException and falls back to opening the Command Palette, pasting the target command ID, and pressing Enter.
Contexts and App Integration
The vscode.py script registers application matching rules for macOS, Windows, and Linux to recognize VS Code and its variants. It defines three key contexts:
* Global VS Code Context (ctx): Active whenever the app is focused. It maps basic navigation, tab control, splits, and indentation commands to their respective VS Code RPC equivalents.
* Focused Text Editor Context (ctx_editor): Matches when the active window title contains focus:[Text Editor]. To avoid keybinding conflicts in modal environments, standard edit actions like undo, redo, copy, and paste are routed via native VS Code RPCs instead of sending raw keystrokes.
* macOS Context (mac_ctx): Implements OS-specific keyboard fallback overrides (such as cmd-shift-p for the Command Palette).
It also implements cross-context behaviors like standard Multi-cursor support, Find and Replace behaviors, and Tab jumping.
Voice Commands
The vscode.talon file maps natural voice phrases to VS Code commands. Significant command groupings include:
- Views & Panels: Accessing the sidebar ("bar search", "bar explore", "bar extensions") or shifting focus to panels ("panel terminal", "panel output", "focus editor").
- File Management: Opening, renaming, cloning, and finding files ("file hunt", "file create sibling", "file reveal").
- Language Features: Code assistance actions ("definition show", "references show", "format that", "problem fix").
- Git Integration: Direct version control mapping ("git commit", "git diff", "git pull", "git stash pop").
- Debugging & Testing: Standard debugger step commands ("step over", "debug step into", "debug start") and test suite commands ("test run", "test run file").
Workspace Awareness (Terminal & Language Detection)
By default, Talon cannot differentiate between a code editor and an integrated terminal, nor does it dynamically know what programming language is being edited. The repository addresses this by parsing the window title of VS Code.
To leverage these capabilities, you must configure your VS Code window.title settings as explained in README.md.
Language Detection
The vscode_language_mode.py script matches the window title against a regex pattern /lang:\[\w*\]/. When matched, it overrides the global code.language() action. This lets Talon automatically activate language-specific voice syntax commands (e.g., Python or TypeScript contexts) as you switch editor tabs.
Terminal Mode
The vscode_terminal.talon file activates the standard terminal tag when the focused view is an integrated terminal (matching /focus:\[Terminal\]/ in the window title). This lets you seamlessly execute command-line utility voice commands inside VS Code.