Locate Active File in Explorer
A small VS Code extension that adds a toolbar button to the Explorer Files view. Click the button to locate the active editor file in the Explorer without opening the context menu or Command Palette.

Features
- One-click locate: Adds a
go-to-file icon to the right side of the Explorer Files title bar.
- Fast navigation: Expands the file tree and highlights the file that belongs to the active editor.
- Native behavior: Calls VS Code's built-in
workbench.files.action.showActiveFileInExplorer command, so the behavior stays consistent with VS Code.
- No background work: Activates only when the locate command is used.
Why Use It
When working in a large project, you often jump between files and then need to find the current file in the project tree. VS Code already has this capability, but it usually requires one of these flows:
- Right-click in the editor and choose the built-in reveal action.
- Switch to Explorer with
Ctrl+Shift+E and search manually.
- Run the locate command from the Command Palette with
Ctrl+Shift+P.
This extension turns that repeated workflow into a single click in the Explorer.
Install
From a VSIX file
- Download the
.vsix package from the project release artifact.
- Open VS Code.
- Run Extensions: Install from VSIX... from the Command Palette.
- Select the downloaded
.vsix file.
From source
npm install
npm run compile
Then open this folder in VS Code and press F5 to start an Extension Development Host.
How To Use
- Open a folder or workspace in VS Code.
- Open any file from that workspace.
- Move the pointer over the Files section title in the Explorer.
- Click the
go-to-file icon in the title bar.
- VS Code locates and highlights the active file in the Explorer.
Development
npm install
npm run compile
npm run watch
Useful project files:
src/extension.ts: extension activation and command registration.
package.json: VS Code contribution points, command title, menu placement, and package metadata.
assets/preview.gif: README preview animation.
Release Workflow
The repository includes a manual GitHub Actions workflow at .github/workflows/release.yml.
It is intentionally triggered only by workflow_dispatch for now. When started manually, it validates that the release tag matches package.json, installs dependencies, compiles the extension, packages the VSIX, verifies the package contents, uploads the VSIX as a workflow artifact, and creates a GitHub Release.
Example release tag:
v0.0.4
Privacy
This extension does not collect telemetry, call external services, or store user data. It only invokes a built-in VS Code command inside the local editor.
Known Limitations
- The button is visible only in the Explorer Files view (
workbench.explorer.fileView). If that view is hidden, the button is not shown.
- The button uses VS Code's built-in Codicon icon set.
Changelog
See CHANGELOG.md.
在资源管理器中定位当前文件
这是一个轻量级 VS Code 扩展,会在“资源管理器”的“文件”视图标题栏增加一个快捷按钮。点击按钮即可在资源管理器中定位当前编辑器文件,无需再打开右键菜单或命令面板。

功能
- 一键定位:在 VS Code “资源管理器”的“文件”标题栏右侧新增一个
go-to-file 图标。
- 快速访问:点击后展开文件树,并高亮当前激活编辑器对应的文件。
- 原生体验:调用 VS Code 内置命令
workbench.files.action.showActiveFileInExplorer,定位行为与 VS Code 保持一致。
- 无后台任务:仅在执行定位命令时激活。
解决的问题
在大型项目中开发时,我们经常会在多个文件之间跳转。想查看当前文件在项目结构中的位置,通常需要:
- 在编辑器中右键,执行 VS Code 内置的定位操作。
- 使用
Ctrl+Shift+E 切换到资源管理器,再手动查找。
- 通过命令面板 (
Ctrl+Shift+P) 执行定位命令。
这个扩展把上述高频操作简化成资源管理器中的一次点击。
安装
通过 VSIX 安装
- 下载项目发布产物中的
.vsix 文件。
- 打开 VS Code。
- 在命令面板中执行 Extensions: Install from VSIX...。
- 选择下载好的
.vsix 文件。
从源码运行
npm install
npm run compile
然后用 VS Code 打开本仓库,按 F5 启动 Extension Development Host。
如何使用
- 在 VS Code 中打开一个文件夹或工作区。
- 打开工作区内的任意文件。
- 将鼠标移动到左侧资源管理器的“文件”视图标题栏。
- 点击标题栏中的
go-to-file 图标。
- VS Code 会在资源管理器中定位并高亮当前文件。
开发
npm install
npm run compile
npm run watch
关键文件:
src/extension.ts:扩展激活逻辑和命令注册。
package.json:VS Code 贡献点、命令标题、菜单位置和包元信息。
assets/preview.gif:README 预览动图。
发布流程
仓库包含一个手动触发的 GitHub Actions workflow:.github/workflows/release.yml。
它目前只通过 workflow_dispatch 手动触发,不会在 push、合并到 main 或创建 tag 时自动执行。手动启动后,它会校验 release tag 与 package.json 版本一致,安装依赖,编译扩展,打包 VSIX,检查包内容,上传 VSIX artifact,并创建 GitHub Release。
示例 release tag:
v0.0.4
隐私
本扩展不收集遥测数据,不访问外部服务,也不存储用户数据。它只会在本地编辑器中调用 VS Code 内置命令。
已知限制
- 按钮仅在“资源管理器”的“文件”视图 (
workbench.explorer.fileView) 中可见。如果该视图被隐藏,按钮不会显示。
- 按钮图标依赖 VS Code 内置的 Codicon 图标库。
更新日志
详见 CHANGELOG.md。