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

Focus File

1Asy-bit

|
16 installs
| (0) | Free
Reveal the active file in the Explorer with a one-click button in the Explorer title bar (between Refresh and Collapse)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Focus File

English · 中文


English

Reveal the active file in the Explorer with a one-click button: a locate icon in the Explorer title bar, placed between Refresh and Collapse All.

Features

  • Locate button in the Explorer header — a navigation@35 button precisely between Refresh ↔ Collapse All (built-in Refresh is order 30, Collapse All is order 40, this button is order 35)
  • Reveal on click — focuses the Explorer, scrolls to the active file, highlights it, and expands the parent folders as needed
  • Works in diff views — native diffs (single-file, e.g. clicking a file in the Source Control panel) and multi-file diffs (the multi-diff editor, e.g. Open All Changes), as well as synthetic diffs, all locate the compared file. Every side of every diff is resolved back to a real workspace file, since diff sides are often not real files (git: URIs for staged changes, temp files for synthetic diffs). If a diff has focus, that file wins
  • No active file? — shows a friendly notice instead of doing nothing
  • Command Palette — also available as Locate Current File in Explorer
  • Bilingual UI — English and Simplified Chinese, follows the VS Code display language

Usage

Open a file, then click the locate icon in the top-right corner of the Explorer (New File / New Folder / Refresh / 🎯 Locate / Collapse All). No configuration needed.

FAQ

Icon not showing? The button only appears in the Explorer title bar when a folder is open. Without a folder, the Explorer header toolbar is not shown — the Command Palette command still works.

Development

npm install
npm run compile     # compile TypeScript to dist/
npm run package     # package a .vsix

License

MIT


中文

在资源管理器标题栏(最外层文件夹行)的工具栏中,为"刷新"和"折叠全部"之间增加一个 定位图标(🎯)。点击即可在资源管理器中滚动并选中当前正在编辑的文件。

功能特性

  • 资源管理器头部定位按钮——navigation@35 定位按钮,精确位于 刷新 ↔ 折叠全部 之间(内置刷新 order 30、折叠全部 order 40,本按钮 order 35)
  • 点击即定位——焦点切到资源管理器,自动滚动到当前文件、高亮选中,并展开必要的父级文件夹
  • diff 视图可用——原生 diff(单文件,如源代码管理面板点文件;多文件,如"打开全部更改")与合成 diff 都能定位。每个 diff 的两侧都会折算回工作区里的真实文件(暂存区 diff 是 git: URI、合成 diff 右侧是临时文件,都不是真实文件);有聚焦的 diff 时优先定位它
  • 无活动文件时——给出友好提示,而不是无响应
  • 命令面板——也可通过 在资源管理器中定位当前文件 命令执行
  • 中英双语界面——随 VS Code 显示语言自动切换

使用

打开一个文件,点击资源管理器右上角(新建文件/新建文件夹/刷新/🎯定位/折叠全部)中的定位图标即可。无需任何配置。

常见问题

图标没出现? 本按钮只在有文件夹打开时出现在资源管理器(Explorer)标题栏。若尚未打开任何文件夹,资源管理器不显示该工具栏,命令面板中的同名命令依然可用。

开发

npm install
npm run compile     # tsc 编译到 dist/
npm run package     # 生成 .vsix

许可证

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft