vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Add a command-line argument to prevent an opened file/directory from being included in VS Code's recent files list

Open MaddyGuthridge opened this issue 8 months ago • 3 comments

I use a script to automate the marking process when I assess work created by my students. This script:

  1. Git clone's their work to a temporary directory
  2. Checks out their latest commit to main before the assignment deadline
  3. Displays their student info
  4. Launches VS Code to show their work and waits for it to exit

This works fine, but after finishing marking, I'll have tens of entries to remove from my history, which is incredibly annoying.

Looks like I have some spring cleaning to do VS Code recent items list, entirely filled with temporary directories

I wish there was a command-line argument I could use to prevent the file from being added to VS Code's history. Perhaps something like:

code /tmp/tmp.5oCctPYt8z -nw --no-history

Currently, I have tried to make my script modify VS Code's history to filter out the directories it opened, but this has been ineffective, and is a large maintenance burden due to the frequently-changing database structure.

Image

Alternative solutions

  • Add a setting to allow me to specify directories that shouldn't appear in VS Code's history. This would require a little more manual effort for users of my script, but is acceptable.

MaddyGuthridge avatar Mar 31 '25 12:03 MaddyGuthridge

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

This is already possible today: just add --skip-add-to-recently-opened.

https://github.com/microsoft/vscode/blob/e75b1768984cdc056743a7793dbc2e0787cc983b/src/vs/platform/environment/node/argv.ts#L180

bpasero avatar Nov 11 '25 05:11 bpasero

@bpasero it's great that this option exists, but it appears to be entirely undocumented. Notably, I was not able to find documentation in:

Can this feature (and perhaps any other missing flags) be documented please? I'd hate for others to encounter the same struggles as me.

MaddyGuthridge avatar Nov 12 '25 14:11 MaddyGuthridge

Opened https://github.com/microsoft/vscode-docs/issues/9049

bpasero avatar Nov 12 '25 14:11 bpasero