Visual Studio Code always reopens previous file or folder

前端 未结 8 1982
心在旅途
心在旅途 2020-11-30 01:43

VSCode always seems to remember my session and reopen the files and/or project that were open the last time I used it. It obviously behaves correctly when running it from th

相关标签:
8条回答
  • 2020-11-30 01:59

    Below worked for me

    Right-click on Shortcut and add --disable-gpu to Target as per screen shot.

    0 讨论(0)
  • 2020-11-30 02:01

    You can add the -n option to the startup of VS Code and it will always start with an empty window, not restoring your previous session.

    0 讨论(0)
  • 2020-11-30 02:01

    01 December 2018

    This works for me. i.e. "C:\Users\Sampath\AppData\Local\Programs\Microsoft VS Code\Code.exe" -n

    0 讨论(0)
  • 2020-11-30 02:04

    You can also go into your settings and use the following:

    "window.reopenFolders": "none"

    which will not reopen the folders you were working on when you closed the editor. The other options are one (the default) and all.

    Edit 2017-11-09:

    The option is now changed in latest versions.

    "window.restoreWindows": "none"
    

    See Mathieu DOMER's answer.

    Edit 2018-09-12:

    Another setting related to this is the hotExit setting. This has been discussed in this answer to a related question. To prevent reopening and remembering unsaved files, you can set this to:

    "files.hotExit": "off"
    

    But from the test I've made, when the window.restoreWindows setting is set to none, this is not needed. I haven't tested every possible combination, so YMMV.

    And to answer a question in the comments, to edit the settings, you have to open the settings file. Some documentation can be found here (at least on the date I am writing this).

    0 讨论(0)
  • 2020-11-30 02:05

    With latest update, it seems that the parameter has changed, now use:

    "window.restoreWindows": "none"
    
    0 讨论(0)
  • 2020-11-30 02:06

    In VS Code, type Ctrl+, (or choose File/Preferences/Settings) to open the settings page, then type restoreWindows in the Search settings input to filter for this setting. Set it to none and restart the browser.

    0 讨论(0)
提交回复
热议问题