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

CommandSocket

Pascal Diehm

|
309 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

The CommandSocket extension allows you to receive updates about the state of your VSCode editor and trigger commands, alerts and the like from an external application or script using a simple WebSocket API.

Features

The extension can act as a server, listening for incoming WebSocket connections, and as a client, connecting to a remote WebSocket server (see commandsocket.role in settings). Every message sent to and from this extension is a JSON object encrypted with a password, if set.

Requests

Each request has to specify an id (echoed back in the response) and a type (see the table below).

Type Description Parameters Responses
alert Display a message box message: string
level?: {info,warn,error}
options?: string[]
ok - The message box was dismissed
string - An option was selected
status Display a status message message: string
timeout?: number
ok
input Display an input box title: string
placeholder?: string
value?: string
password?: boolean
string - An input has been received
error - The input was cancelled
pick Display a quick pick title: string
options: string[]
placeholder?: string
multi?: boolean
string - An option was selected (multi is falsy)
strings - Options were selected (multi is truthy)
error - The quick pick was cancelled
command Run a command command: string
args?: any[]
ok
debug-start Start a debugging target name: string
folder?: string
ok - The debugging target was started
error - The debugging target could not be started
debug-stop Stop debugging ok - The debugging target was stopped
activate Manually activate an extension extension: string ok - The extension was activated
error - The extension could not be activated

Responses

Each response contains an id (echoed back from the request) and a type (see the table below). Responses are only sent in response to a request. When responding to an invalid request, null is used as the id.

Type Description Parameters
ok Request successful
error Request failed message: string
string Request returned a string value: string
strings Request returned an array of strings values: string[]

State updates

Each state update contains a type (see the table below). State updates are sent whenever the state of the editor changes. Parameters marked optional are always included but may be null.

Type Description Parameters
version Version of the editor version: string
focus Focus state of the editor window focus: boolean
commands List of available commands commands: string[]
debug State of the debugger debug: boolean
name?: string
breakpoints: number
environment Environment of the editor host: string
name: string
language: string
remote?: string
shell: string
extensions List of installed extensions extensions: string[]
active: string[]
workspace Workspace information trusted: boolean
name?: string
folders?: string[]
git Git information branch?: string
commit?: string
ahead?: number
behind?: number
remote?: string
url?: string
changes?: number
editor Editor information name?: string
path?: string
language?: string
encoding?: string
eol?: string
indent?: number
tabs?: number
dirty?: boolean
column?: number
line?: number
lines?: number
warnings?: number
errors?: number

Settings

Name Description Default
commandsocket.role Role of the extension (server or client) client
commandsocket.host Bind address or remote address empty
commandsocket.port Bind port or remote port 6783
commandsocket.password Password for encryption empty
commandsocket.timeoutReconnect Client reconnection timeout (ms) 5000
commandsocket.timeoutManualUpdate Frequency of manual state update detection (ms) 1000

Encryption details

If a password is set, all incoming data is decrypted and all outgoing data is encrypted using that password. Encryption is handled by a combination of scrambling and XORing the data with the password, see global.ts (encrypt and decrypt functions) for details.

Use with Bitfocus Companion

This extension is designed to work seamlessly with the module companion-module-microsoft-vscode, allowing you to control and interact with Visual Studio Code vie Elgato Streamdeck and other controllers. You can use the provided actions to display notifications, run commands, retrieve editor information, and more, enhancing your VS Code workflow.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft