新鲜文件资源管理器 – VS Code 扩展,用于浏览最近的工作
Fresh File Explorer – VS Code extension for navigating recent work

原始链接: https://github.com/FreHu/vscode-fresh-file-explorer

## Fresh File Explorer:摘要 Fresh File Explorer 是一个 VS Code 扩展,旨在快速浏览 Git 仓库中的近期和相关更改,提供一个专注于当前需求的替代方案,不同于标准的源代码管理或 GitLens 视图。它优先考虑*找到你现在需要的东西*,而不是全面的 Git 管理。 主要功能包括显示待处理的更改、在可配置时间范围内修改的文件,甚至**已删除的文件**(带有“Exhume”以查看内容和“Resurrect”以恢复)。文件按目录、作者、提交哈希,甚至以月相来组织!“固定项目”部分允许随时访问关键文件,无论最近的活动如何——非常适合笔记、API 密钥或图表。 该扩展增强了搜索功能,提供链式搜索和按作者/提交过滤的选项。它还提供同步状态通知,并支持多仓库工作区和子模块。最终,Fresh File Explorer 旨在通过提供清晰、可定制和高效的文件定位和管理方式,减少在大型代码库中工作时的摩擦。它不是 GitLens 的替代品,而是针对专注、即时访问你的工作的补充工具。

一个新的 VS Code 扩展,“Fresh File Explorer”,旨在通过关注最近和相关的工作来改善文件导航。它不显示所有文件,而是优先显示具有未提交更改或在指定时间范围内修改过的文件,利用 Git 历史记录。主要功能包括可视化文件最近使用情况的热图、显示已删除的文件以及用于常用项目的固定部分。 讨论很快转向 VS Code 扩展的安全问题。用户对缺乏强大的沙箱机制表示担忧,这让他们不愿使用来自未经审查来源的扩展。虽然扩展作者保证他们当前的 代码是安全的,但更广泛的问题仍然存在——信任潜在的、强大的第三方代码。 建议包括自我审计扩展和利用开发容器,但最终,用户认为需要 VS Code 本身进行根本性的安全改进,类似于 WebAssembly 的实现,但不太可能被优先考虑。
相关文章

原文

Easily navigate recent changes based on your pending work and Git history.

Marketplace | OpenVSX

view

Switch between viewing pending (uncommitted) changes or files modified in configurable time periods. Pending Changes mode shows uncommitted changes (esentially what the Source Control view would give you)

time-windows

Files are grouped by directory structure, with file counts on folders. Auto-expands to configurable depth.

  • Deleted files appear in the tree, clearly indicated
  • Exhume: Open deleted file content in a read-only temp file (default action on clicking a deleted file)
  • Resurrect: Restores the exhumed file to its original location

resurrect

Toggle heatmap coloring to give files distinct colors based on their most recent edit. Brighter colors = more recent.

heatmap

This coloring is toggled in the Fresh Files view, but will also apply to the File Explorer.

At the top the tree, there is a special "pinned items" section. This is for files you want to keep handy independent of whatever the fresh file explorer is showing you. You can pin items with drag&drop or through the right click menu in the file explorer.

pinned section

  • Pin a non-fresh file you need to pay attention to, like a diagram or readme
  • Pin that critical file you've had on your desktop for the last 6 years. It does not have to be from your workspace.
  • Pin a deleted file
  • Pin a search editor (must be saved as a file)
  • Create short notes and use it as a todo list. They can be reordered and marked as complete.
  • Pin your sensitive API keys as notes. All the pros do it.

The pins are stored per workspace.

Sync Status Notifications

alt text Displays info at the top of the tree view:

  • When you are behind/ahead of the remote (meaning you need to push/pull)
  • When you are behind/ahead of the base branch (meaning you need to merge)

Both options can be individually disabled.

  • Filter by Author: Hide files from specific authors
  • Filter by Commit: Hide files from specific commits
  • Clear filters
  • Filters are temporary and reset when changing time windows

filter-commit

Note: The extension tracks the most recent commit per file only. If a file was modified by both a filtered author and a non-filtered author within the time window, the file will be hidden entirely (because the most recent commit is what's filtered). This is a deliberate simplification - for deeper history analysis, consider using something like GitLens or learning more than 5 git commands.

Organize your files in different ways beyond the standard folder structure:

grouping modes

  • File Structure - Traditional folder hierarchy

  • Author - Files grouped by who last modified them

  • Commit Hash - One group per commit

As well as two additional groupings for advanced git blame use cases.

  • Moon Phase (git blame moon)

Uneven distribution of commits during the full moon can indicate werevolves among your contributors.

  • Planetary Retrograde (git blame universe)

Includes Pluto.

Note: This is astronomy (hard science), not astrology (garbage). If you want to know if you will have merge conflicts with the changes made by a sagitarius, you need to look elsewhere.

quick-open

Use "Fresh Files: Quick Open" to get a quick pick showing files from your Fresh File Explorer view. Type to filter by filename or path, then select a file to open it. This is similar to VS Code's Ctrl+P, but filtered to only your fresh files, with some additional actions on top.

Features:

  • Respects current time window, author and commit filters
  • Special filter options to refine the list
  • Special search option to trigger a fulltext search within these files
  • You can use the filter first and then search to narrow down the list
    • First filter for example "pending modified"
    • A second quick pick will be shown with only those files
    • Now the search action will search only pending modified files

Note: the quick open excludes deleted files. You'll have to access those from the tree.

  • Open / Open to Side - will open either the file or a diff depending on your preference. If the file is already open in some editor group, it will be focused instead.
  • Reveal in Explorer / Source Control
  • Discard Changes (for pending files)
  • Resurrect (for deleted files)

Works with:

  • Folders containing multiple repos in subfolders
  • Multi-root workspaces
  • Worktrees

Submodules:

  • Submodules are shown in the tree but not their contents.
  • You can also see deleted submodules, but can't exhume them.

I wanted to do more with submodules just for the fun of it but turns out it's not fun at all.


The extension adds several search features.

Mode Question it answers Searches
Search in Fresh Files Where is x in my current work? File contents, on disk, scoped to fresh files
Search in Found Files I want to find y in all files that contain x. File contents, on disk, chained from a previous search
File History What's the full history of this file? Git log for an entire file, following renames
Diff Search When was x ever added or removed? Git diff history across all commits (pickaxe)
Line / Function History What's the full history of this function or code block? Git log for a specific line range or function name (log -L)

alt text

Answers the question "when was this string ever added or removed?"

Access through the editor right-click menu ("Search Diffs for Selection").

Results appear in a tree view grouped by file and commit, and each match can be clicked to navigate to it.

Line and Function History

l-history Access via right-click in the editor → "Line/Function History".

Based on your selection, shows every commit that touched those lines or that function, following renames. This is a wrapper of git log -L.

  • Single cursor / single line — treated as a function name (uses the word under the cursor as the funcname pattern)
  • Multi-line selection — treated as a line range

A / B comparison: Mark any two commits as A and B, then click Compare to open a diff between those two versions of the file.

file history

Available via:

  • right-click menu in the Fresh File Explorer tree
  • right-click in the editor context menu

The search icon in the Fresh Files toolbar will open VS Code's search view with all currently visible files pre-filled in the "files to include" pattern. This lets you search only within the files you're actively working on, respecting your current filters and time window. This searches file contents on disk. To search the tree itself, use CTRL+ALT+F.

You can also trigger the search from the quick pick.

search

  • Respects author and commit filters
  • Excludes deleted files (they're not on disk to search)
  • Configure whether the search opens in the view or as an editor (default)

Problem: "I want to find b in all files that contain a."

Solution: Search for a, then use this action to open another search editor scoped to the files you found with your first search, then search for b. This process can be chained as many times as you want.

search in found files

The action is available only in search editors, not the search view. But you can easily open your search view as a search editor.

Configuration:

  • freshFileExplorer.openSearchInEditor: Open searches in a Search Editor tab instead of the Search view
  • freshFileExplorer.searchPatternMaxLength: Maximum pattern length per batch. Set a lower value if you encounter command-line length limits on your OS, or a higher value if your searches are getting batched. The default (4000 chars) is very conservative and can likely be set much higher on Linux.

When you have many files or very long paths, VS Code's underlying search mechanism (ripgrep) can hit OS command-line length limits. In this case, the file list will be split into batches which will open as separate search editors.

search editor actions There are several new action buttons in the search editor results:

  • Search in found files - new search scoped to the files you found
  • Open all found files - opens all files as background tabs
  • Copy paths - copies all absolute or relative paths from the results

"I just cloned a large repo and don't know where to start"

You joined a new company and the codebase has thousands of files. Most haven't been touched in the last 75 years. But the file explorer shows everything, making it overwhelming to find where active development is happening.

Approach How it works Friction
Default VS Code Browse folders manually, maybe search for recent commits in Source Control High - requires mental context switching, no visual overview
GitLens Use "Commits" view to see recent commits, then navigate to files from there Medium - commit-centric view, extra clicks to open files
Fresh File Explorer Open the Fresh Files panel, see all files modified in last 30 days as a file tree Low - immediate visual overview, familiar tree navigation

"I swear this file was here at some point"

You remember a file existed, but it's not there. Was it renamed? Moved? Did you misremember the path? Have you been drinking again? It's someone else's fault this time, but you're questioning your own sanity.

Approach How it works Friction
Default VS Code Search for the filename, find nothing, assume you're wrong High - no hint that deletion occurred
GitLens Would need to think "maybe it was deleted" and search commit history High - requires the right mental model
Fresh File Explorer Deleted files appear right where they used to be Zero - it's still there, just marked as deleted

"I accidentally deleted some files and need them back"

Pain Point: You deleted files and realize you need them. They're committed to git but you wish it was easier to get them back.

Approach How it works Friction
Default VS Code git log --diff-filter=D, then git checkout <hash>^ -- <path> High - requires git expertise
GitLens Find the deletion commit, view file at revision, copy content Medium - several steps
Fresh File Explorer Deleted files are there, right-click → "Resurrect" Low - one-click restore. Works on multiple files at once.

"I made a commit and now I've lost track of what I was working on"

You make a commit but now your "pending changes" view is empty. You've lost the mental map of which files you were touching. This actually discourages small, frequent commits because you want to keep that overview.

Approach How it works Friction
Default VS Code Pending changes disappear after commit, must remember or check git log High - punishes good commit practices
GitLens Can view recent commits, but context switch required Medium - the information is there, but in a different place, and you can only have so many views open at a time
Fresh File Explorer Set time window to "Last 7 days" - your committed files still appear, organized by directory Low - commit freely, overview persists

"I was using Fresh File Explorer and it was going great, but then someone reformatted the entire codebase and now all the files are fresh"

Pain Point: A large automated change (formatting, linting, dependency updates) pollutes your view of what actually changed.

Approach How it works Friction
Default VS Code No built-in way to filter by author High - must use terminal commands
GitLens Can filter by author in various views Medium - need to know where to look
Fresh File Explorer Filter out the person doing the formatting, or (it was you, wasn't it?) the commit where it was done Low - visual multi-select, instant feedback

"Cool extension but I was looking for a todo list app"

Pain Point: There just aren't enough todo list apps out there.

Approach How it works Friction
Default VS Code Is not a todo list High - must vibe-code your own todo list
GitLens Is probably not a todo list Medium - I don't know, maybe it even has a todo list
Fresh File Explorer Is also a todo list Low - Can't miss it

"Cool extension but can it group my files by moon phase"

Yes. It might even be the only piece of software that does that.

Look under freshfileexplorer. to see all configurable settings.

If you find a bug or have an idea for a faster horse, open an issue.

For bug reports, it is extremely helpful if the problem is reproducible on a public repository.


Fresh File Explorer is not a GitLens replacement. It's a more focused, opinionated tool oriented around finding things you need right now. It doesn't make commits, manage branches, stashes, tags...

Use Fresh File Explorer when

Use GitLens when

gitlens views

Because one of those 25 is actually very similar to Fresh File Explorer, some more comparison can be found here.

This is above average for a VS Code extension.

(a chatbot instructed to pretend to be Linus Torvalds)

联系我们 contact @ memedata.com