CrabCode for Visual Studio Code
Use CrabCode in Visual Studio Code. The
extension connects to a CrabCode Gateway, providing streaming chat, code-aware
actions, session management, permission prompts, file-change review, and
checkpoint recovery without leaving the editor.
Requirements
- Visual Studio Code 1.85.0 or later.
- Python 3.10 or later when the extension starts a local Gateway.
- A running CrabCode Gateway for a remote connection.
- A model provider configured on the Gateway, with its required credentials.
Quick start
Install this extension from the Visual Studio Marketplace.
For a local Gateway, install CrabCode with Gateway support:
python -m pip install "crabcode[gateway]==0.1.5"
crabcode gateway
The default Gateway WebSocket address is ws://localhost:4096/ws.
The extension can also detect, install, and start a local Gateway when
crabcode.gatewayAutoInstall is enabled.
Configure the model provider, model, and credentials on the Gateway machine
using ~/.crabcode/settings.json. See the
model configuration examples.
Provider API keys belong to the Gateway configuration, not the extension's
crabcode.password setting. Restart the Gateway after changing its environment.
Open a project folder in VS Code, select CrabCode in the Activity Bar,
and send a message. Use CrabCode:连接网关 if a connection is not established.
For a Gateway on another machine, start it there and configure
crabcode.serverUrl with its ws:// or wss:// address. Use wss:// when
the Gateway is accessed beyond the local machine. Remote Gateways must already
be installed and running; the extension does not install them remotely.
Features
- Streaming chat with Markdown, code blocks, diffs, tool results, attachments,
permissions, choices, and plans.
- Explain, fix, refactor, test, or send the selected editor code to chat.
- Create, resume, interrupt, and fork conversation sessions.
- Review and keep or undo pending file edits.
- Start, reconnect to, or restart a local Gateway from the editor.
- Send the active editor context, selection, cursor position, and visible files
to the Gateway.
Configuration
Open Settings and search for CrabCode, or add settings such as:
{
"crabcode.serverUrl": "ws://localhost:4096/ws",
"crabcode.autoConnect": true,
"crabcode.gatewayAutoInstall": true,
"crabcode.pythonPath": "",
"crabcode.showDiffOnFileChange": false
}
Gateway authentication
The Gateway binds to 127.0.0.1:4096 and disables authentication by default,
unless you have configured another security mode. To enable password
authentication for a manually started Gateway, for example in a POSIX shell:
export CRABCODE_GATEWAY_PASSWORD="replace-with-a-strong-password"
crabcode gateway --security-mode password
Set the same value in VS Code User Settings:
{
"crabcode.serverUrl": "ws://localhost:4096/ws",
"crabcode.password": "replace-with-a-strong-password"
}
The extension sends this value as a Bearer credential using the Gateway's
compatible password authentication. This setting is stored in VS Code's
settings JSON; do not add a real password to shared workspace settings or source
control. The extension does not perform the Gateway's public-key challenge and
signature flow; use password mode, or the password method in mixed mode.
For a remote Gateway, configure HTTPS/WSS and use its wss://.../ws address.
crabcode.chatModels lists the Gateway model profiles shown in the chat UI;
crabcode.chatModelDefault selects the initial one. crabcode.permissionMode
controls how the current Gateway session handles tool permissions.
By default, Enter sends a message and Ctrl+Enter (Windows/Linux) or Cmd+Enter
(macOS) inserts a newline. Set crabcode.composerSendKey to mod_enter to
reverse these actions.
Commands
Open the Command Palette and run one of the following:
CrabCode:打开聊天
CrabCode:解释选中代码
CrabCode:修复选中代码
CrabCode:重构选中代码
CrabCode:为选中代码添加测试
CrabCode:发送到聊天
CrabCode:连接网关 / CrabCode:断开网关
CrabCode:新建会话 / CrabCode:中断当前任务
CrabCode:重启网关 / CrabCode:打开扩展设置
Troubleshooting
- Cannot connect: check
crabcode.serverUrl, the Gateway process, and the
password. The local health endpoint is http://localhost:4096/health.
- Python not found: set
crabcode.pythonPath to the Python 3.10+ executable
in the environment where you installed CrabCode.
- Incompatible Gateway: follow the local upgrade prompt, or upgrade the
Gateway on its host if using a remote connection.
- Connected but model requests fail: check the Gateway's model configuration
and provider credentials.
Open View → Output → CrabCode for connection and startup diagnostics.
crabcode.debugLogRawWsPayload is off by default; enabling it can log message
content, so review logs before sharing them.
Building from source
From packages/vscode, use Node.js 24 (the tested version is in .nvmrc):
nvm use
npm ci
npm run lint
npm test
npm run package
The package command builds the extension and creates crabcode-0.1.5.vsix.
Install it with Extensions → … → Install from VSIX…, or run
code --install-extension crabcode-0.1.5.vsix. Node.js and npm are only required
for building the extension, not for installing the VSIX in VS Code.
Support and source
Report issues or contribute at
ylzz1997/crabcode. The full Gateway
configuration and security documentation is in the repository's
README.
License
MIT