Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open folders in VSCode via Terminal in a fresh state?

It appears that VSCode always opens a folder in with the last UI state it had.

I'm looking for something like Sublime's remember_open_files: false, or in other words, I would like VSCode to open up with a clean UI state regardless of what state the UI was in the last time the folder was open.

What's happening now:

cd my-project-folder/ code . # VSCode opens folder with saved UI state 

What I want:

cd my-project-folder/ code . # VSCode opens folder with fresh UI state 
like image 842
Alex Avatar asked May 18 '17 09:05

Alex


People also ask

How do I open a folder in VS Code in terminal?

Great, now to open a folder to VSCode, just type code . and it'll magically open your folder into a new VSCode window! .

How do I open a folder in terminal?

To open a directory on a computer with a graphical interface, you double-click on a folder. It opens, and you are now "in" that folder. To open a directory in a terminal, you use the cd command to change your current directory. This essentially opens that folder and places you in it.

How do I change directory in VS Code terminal?

Open Visual Studio Code and access the Command Palette (⇧⌘P) and start typing shell command and select option Shell Command: Install 'code' command in PATH. After that you're able to start a new terminal window, change into your project directory and use code . to open the current directory in Visual Studio Code.


1 Answers

I tried to do it through command line using the command

code -n . 

which should have opened VS code in current folder with a new session but it does not seem to work at all. I believe that code . seems to ignore the -n new session option and restores the previous session for the folder. So this feature is probably not implemented in VS code.

(Refer here for the commandline options for VS code.)

like image 115
Kronos Avatar answered Oct 01 '22 01:10

Kronos