vscode
The community/apps/vscode directory contains files that integrate Talon with VS Code, providing enhanced control and automation. It includes the following important components:
-
The
command_clientsubdirectory provides a mechanism for Talon to communicate with VS Code using a file-based RPC (Remote Procedure Call) system. It contains its own documentation, but the high-level idea is that Talon can send commands to VS Code and receive responses, even if VS Code doesn't have a direct API for Talon to interact with.- The
rpc_clientsubdirectory contains the generic RPC client. It provides actions for writing requests to files, reading responses from files, and handling potential race conditions and errors. The main entry point is therpc_client_run_commandaction, which takes a command id and up to five optional arguments. - The files directly within the
command_clientdirectory provide the user-facing interface to the RPC system, and provide application-specific configurations.command_client.pyprovides actions that callrpc_client_run_commandfromrpc_client, and also defines an OS-specific action to trigger the command server.vscode.pyandvisual_studio.pyset theuser.command_clienttag for their respective applications, and they provide thecommand_server_directoryaction, pointing to their communication directories.vscode.pyalso defines convenient actions for calling VS Code commands, and it falls back to the command palette if the command server isn't available. vscode_terminal.talondefines a tag,terminal, that is enabled when the VS Code terminal is focused. It uses a special string in the window title to determine this. TheREADME.mdin this directory explains how to configure VS Code to include the special string in the title, and how to add tags when the terminal tag is active, which can be used to enable additional terminal commands.README.mdprovides a general overview of the VS Code support, including instructions for installing the VSCode talon extension pack and setting up Cursorless. It also provides instructions for enabling terminal commands via the window title, as described above.vscode.talonprovides a large number of custom commands for VS Code. It defines tags for features such as find and replace, line commands, multiple cursors, splits, tabs, and command search. It defines convenient actions for navigating the UI, working with files, and using language features. It provides commands for common tasks such as going to symbol, showing settings, working with snippets, and navigating code. It has many commands for working with git, testing, debugging, the terminal, tasks, and more. Many of these actions use theuser.vscodecommand, which uses the command palette. Some actions use the new command server, viauser.vscode_and_wait. It also provides actions to copy a file's name, path, or local path.vscode.pydefines the VS Code application context for Talon, and sets up bindings to various Talon actions. It also contains actions that are used byvscode.talon, such asuser.vscode_terminal, which is used to switch between different terminal windows by number. It also contains implementations of generic Talon app actions such astab_open,tab_close,tab_next,tab_previous, andwindow_close. Additionally, it provides implementations forcode.toggle_comment,edit.indent_more,edit.indent_less,edit.save_all, andfind_next,find_previous, and many more. This file also defines implementations of split windowing actions, and also provides multi-cursor support by leveraging VS Code's built-in functionality. It provides implementations for tab management (jumping to specific tabs), and actions for find and replace. It also allowsuser.insert_snippetto send an RPC command to VS Code to insert a snippet.
- The
These files work together to provide a comprehensive set of tools for interacting with VS Code. The command_client allows for powerful and robust RPC calls, while vscode.talon provides a user-friendly interface to VS Code's commands, and also defines convenient actions for doing things that would normally be done using the command palette. vscode.py provides the glue between these different systems and also provides implementations for generic Talon actions.