Skip to content

Remove matching entries from VSCodes history when hiding files or a folder #60

Open
@CombeeMike

Description

@CombeeMike

Extension usage

Here's how I mainly use your extension, which might help in understanding my feature request better:

I have a monorepo with a view different packages & apps. The basic structure looks something like this:

/root
  /app
    /app1
    /app2
    /app3
  /packages
    /lib1
    /lib2

For navigation, I mostly use VSCodes Go to file... command, full text search, Find all references and navigation directly in the files tree, where Go to file... is definitely the one I'm using the most.

I'm usually only working inside 1 app at a time and therefore want to hide the other apps to have an easier time navigating through my files. E.g. when starting to work on app1, I use the Hidden items view of this extension to hide app2 & app3.

Describe the Problem

All of the above is working for full text search and for navigation in the tree but VSCode's Go to file... also shows recently opened files w/o considering the files.exclude setting which breaks my workflow a bit.

E.g. when entering package.json in Go to file..., it shows app1/package.json, app2/package.json & app3/package.json even though I have app2 & app3 hidden.

Describe the Solution

I understand that this extension is mostly a "UI layer" which uses built in VSCode settings (files.exclude etc.) and there's nothing you can change about how those settings behave.

However, I recently discovered VSCode's Clear Editor History command, which removes all recently opened entries in the Go to file... dialog.

So, when calling Clear Editor History after updating my hidden apps, it only shows 1 package.json which would be good.

However, this command also clears recently used workspaces & folders which I actually use a lot, so using this command is not really an option for me.

Now here's what I was thinking:

Whenever hiding files or folders using the extension, it could actively remove all items from history which match the "hide pattern" which was just activated.

Tech

This is just FYI, there might be better ways to do this technically. The following was just the first thing that I found:

A very shallow google search revealed vscode.removeFromRecentlyOpened API command which you could probably use for this. I don't know whether or not you could just pass the whole pattern to this API or if you have to give it every single file with its whole path.

If it doesn't except patterns, you could search for all files within the currently open workspace/folder which match the pattern (I'd guess that there's good extension API for that...) and pass every individual match to vscode.removeFromRecentlyOpened.

Alternatives

I could imagine that some users don't want or expect your extension to actively manipulate their recent files history, so you could make this an opt-in feature using some setting like removeHiddenFilesFromHistory or removeFilesFromHistoryWhenHiding which defaults to false.

Additional Context

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions