English | 中文
Proxy Status
A tiny VS Code status bar indicator: see at a glance whether the proxy is on, toggle it from the command palette.
It reads and writes VS Code's own http.proxy setting directly — so toggling immediately affects the VS Code main process (Marketplace, sign-in, Settings Sync) and most extensions that make HTTP requests via Node's http / https.
What it does
- A dot + text on the right side of the status bar tells you whether the proxy is currently on
- To switch: command palette →
Proxy Status: Toggle Proxy. No need to dig into settings.json.
- Edited
http.proxy manually? The status bar updates automatically.
Terminal proxy is out of scope — that belongs to your shell config (~/.zshrc etc.), which is a separate world from VS Code's own network requests.
Status bar display
| State |
Status bar text |
Color |
Proxy on (http.proxy non-empty) |
● Proxy ON |
Green (theme-aware charts.green) |
Proxy off (http.proxy empty) |
● Proxy OFF |
Red (theme-aware charts.red) |
No background color. Hover for a tooltip showing the current proxy URL. Clicking the status bar does nothing — on purpose, to avoid accidentally toggling the proxy.
Toggling the proxy
Only via the command palette:
Cmd+Shift+P → search for Proxy Status: Toggle Proxy
Behavior:
- If
http.proxy is empty → writes proxyStatus.proxyUrl (default http://127.0.0.1:1087)
- If
http.proxy is non-empty → clears it
It writes to the user-level settings.json (applies to all windows).
Configuration
| Setting |
Default |
Description |
proxyStatus.proxyUrl |
http://127.0.0.1:1087 |
The proxy URL to write into http.proxy when toggling on |
You can also edit http.proxy directly (in settings.json or through the Settings UI). The status bar syncs automatically.
Notes
- The VS Code main process and most extensions pick up the new proxy immediately. A few extensions that use their own HTTP client or a custom agent may require
Developer: Reload Window to notice the change.
- Toggling is intentionally command-palette only; the status bar does not respond to clicks.
- The extension does not check whether the proxy port is actually listening — the displayed state reflects the configuration, not connectivity.
Requirements
VS Code ^1.118.0. Cross-platform, no external dependencies.
Proxy Status(中文)
VS Code 状态栏小插件:一眼看到当前是否在走代理,命令面板一键切换。
直接读写 VS Code 自身的 http.proxy 配置 —— 立刻影响 VS Code 主进程(Marketplace、登录、Settings Sync)和大多数扩展通过 Node http/https 发的请求。
能帮你做什么
- 状态栏右侧常驻一个圆点 + 文字,告诉你现在到底有没有走代理
- 想切换时:命令面板
Proxy Status: Toggle Proxy,不用进 settings.json 翻 http.proxy
- 手动改了
http.proxy?状态栏会自动同步
终端代理不在管辖范围 —— 那是你 shell 配置(~/.zshrc 等)的事,跟 VS Code 自身的网络请求是两套体系。
状态栏样式
| 当前状态 |
状态栏显示 |
颜色 |
代理已开启(http.proxy 非空) |
● Proxy ON |
绿(跟随主题的 charts.green) |
代理已关闭(http.proxy 为空) |
● Proxy OFF |
红(跟随主题的 charts.red) |
无背景色,鼠标悬停看 tooltip(含当前代理地址)。点击状态栏不会做任何事 —— 这是有意为之,避免误触把代理关掉。
切换代理
只能从命令面板触发:
Cmd+Shift+P → 搜 Proxy Status: Toggle Proxy
行为:
- 当前
http.proxy 为空 → 写入 proxyStatus.proxyUrl(默认 http://127.0.0.1:1087)
- 当前
http.proxy 非空 → 清空
写入位置是用户级 settings.json(对所有窗口生效)。
配置
| 设置 |
默认值 |
说明 |
proxyStatus.proxyUrl |
http://127.0.0.1:1087 |
切到 ON 时写入 http.proxy 的代理地址 |
也可以直接编辑 http.proxy(settings.json 或设置界面),状态栏会自动同步。
注意事项
- VS Code 主进程和绝大多数扩展会立刻感知新代理;少数扩展(自带 HTTP 客户端 / 自定义 agent)可能要
Developer: Reload Window 才生效
- 切换只能走命令面板,状态栏故意不响应点击
- 不检测代理端口是否在监听 —— 你说开就是开
环境要求
VS Code ^1.118.0,跨平台,无外部依赖。
本地开发 / Local development
This section is for contributors who want to modify the source or package locally. End users can ignore it.
开发
npm install
npm run compile # 编译 TypeScript 到 out/
npm run watch # 开发时持续编译
npm run lint # 运行 ESLint
在 VS Code 中打开本项目,按 F5 即可启动 Extension Development Host 调试插件。
打包与本地安装
npx vsce package --allow-missing-repository # 生成 proxy-status-<version>.vsix
然后:
code --uninstall-extension banwk.proxy-status # 已注册 publisher 为 banwk,id 即 banwk.proxy-status
code --install-extension proxy-status-<version>.vsix
# Cmd+Q 完全退出 VS Code 再重启
或者在 VS Code 扩展面板右上角 … 菜单中选 Install from VSIX...,挑刚生成的文件。