Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>CommandSocketNew to Visual Studio Code? Get it now.

CommandSocket

Pascal Diehm

|
3 installs
| (0) | Free
Allows to control VSCode via a WebSocket.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CommandSocket

This extension allows you to trigger VSCode commands programmatically (through scripts or shortcuts) using websockets.

Features

Every message sent to this extension has to be in JSON format and, if set, encrypted with a password (See Encryption Details). Every request has to have two keys: reqID and action. reqID can be anything and will be echoed back as resID in the response. Action hast to be a valid action, otherwise the request is ignored.

action Function Request parameters Response parameters
alert Display notification message: string
level: info\|warn\|error
options: string[]
selected?: string
status Display status bar text message: string
timeout: number (ms)
list-commands Fetch list of commands all: boolean
list: string[]
run-command Run command command: string
arguments: any[] (more)
good: boolean
response: any
input Get user input title: string
placeholder: string
value: string
value?: string
pick Get user selection title: string
placeholder: string
items: string[]
multi: boolean
selected: string (if !multi)
selected: string[] (if multi)
get-editor Get editor information editor: vscode.TextEditor
get-version Get VSCode version version: string

All request parameters are optional and have a default value. Response parameters marked with a question mark are not included at all, if they don't have a value.

Extension Settings

This extension has two configuration options:

  • commandsocket.port: The port to use for the WebSocket server.
  • commandsocket.password: A password to encrypt transactions. Leave this blank to keep the communication unencrypted.

Encryption details

If a password is set, the incoming data is decrypted and the outgoing data is encrypted using that password. Encryption is handled using the node crypto module using aes-256-gcm. The key is generated from the password using a key length of 32 and the salt commandsocket-salt. The encrypted message (in hex format) is then joined with the IV (in hex format) using a pipe symbol (encrypted-message|IV). For more details find the functions serializeMessage and parseMessage in the extensions source code.

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft