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

How to prevent Visual Studio Code from always reopening the previous files or folders?

1个答案

1

When Visual Studio Code (VS Code) automatically reopens previous files or folders, this is typically because it is configured by default to restore the previous session's state upon startup. If you wish to prevent this behavior, you can achieve it by modifying VS Code's settings. Follow these steps:

  1. Open Settings:

    • You can open the settings by clicking the gear icon in the bottom-left corner and selecting "Settings", or by pressing Ctrl + , (Windows/Linux) or Cmd + , (Mac) to quickly access the settings interface.
  2. Adjust the Setting for Opening Files:

    • Enter window.restoreWindows in the settings search bar to filter the relevant options.
    • You will see a setting named "Window: Restore Windows", which controls how VS Code restores windows upon restart. By default, it may be set to all, meaning all windows are restored.
    • You can change this setting to none, so that VS Code does not open any previous files or folders upon startup.
  3. Save and Restart VS Code:

    • After modifying the settings, ensure your changes are saved (VS Code typically saves settings automatically).
    • Restart VS Code to ensure the new settings take effect.

By following these steps, you should be able to prevent VS Code from automatically reopening previous files or folders upon each startup. This will help you start with a clean workspace every time, especially when switching between multiple projects or when you do not want to automatically load the previous session's content.

2024年10月26日 11:34 回复

你的答案