乐闻世界logo
搜索文章和话题

How to delete recent opened file session on Visual Studio Code?

1个答案

1

In Visual Studio Code, you can remove recently opened files through the following methods:

Method 1: Using the Visual Studio Code Interface

  1. Open Visual Studio Code.
  2. In the top menu bar, click File (or File on Mac).
  3. Select Open Recent.
  4. In the expanded list, you will see a list of recently opened files and folders.
  5. Hover over the item you want to remove; a small 'X' will appear. Click this 'X' to remove the item. On Mac, you may need to swipe the item to reveal the delete button.

Method 2: Editing the Data File

For more thorough cleanup or batch processing, you can directly edit the file where Visual Studio Code stores this information:

  1. Close Visual Studio Code.
  2. Depending on your operating system, locate the folder storing Visual Studio Code's state:
    • Windows: %APPDATA%\Code\User\globalStorage\state.vscdb
    • Mac: ~/Library/Application Support/Code/User/globalStorage/state.vscdb
    • Linux: ~/.config/Code/User/globalStorage/state.vscdb
  3. Open the state.vscdb file with a text editor, but note that it is an SQLite database file, so it's best to use an editor that supports SQLite.
  4. Locate the entries related to recently opened files and delete them.

Method 3: Using the Command Palette

  1. In Visual Studio Code, open the Command Palette using the keyboard shortcut Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac).
  2. Type Clear Recently Opened and select the command that appears to clear the list of recently opened files.

Notes

  • Back up relevant files before proceeding, especially when directly editing files.
  • After completing the operation, restart Visual Studio Code to ensure the changes take effect.
2024年8月10日 08:23 回复

你的答案