Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a file from the integrated terminal in Visual Studio Code?

Is there a way of opening a file from the terminal in Visual Studio Code that opens in the same vscode instance that runs the terminal? Similar to c9 tool in Cloud9.

I'm aware of the code tool, but when you run code something.php from the integrated terminal it opens a new vscode instance, which is not what I want...

like image 309
Jan Jongboom Avatar asked Dec 29 '16 10:12

Jan Jongboom


People also ask

How do I open a terminal in Visual Studio?

The Visual Studio terminal is built on top of Windows Terminal. To open the terminal in Visual Studio, select View > Terminal.

Why terminal is not opening in VS Code?

Changing Default Command Line Shell Then, click on the arrow on the side of a plus (+). Here, choose Select Default Profile. Then, select any other type of command line shell. Then, restart vs code and try working on terminal.


2 Answers

You can use -r or --reuse-window command line option.

code -r something.php 
like image 61
zloy_zhake Avatar answered Sep 22 '22 16:09

zloy_zhake


I don't know what operating system you're using, but on MacOS you can just say open filename.ext in the integrated terminal, and it will open a new tab in the same VSCode instance, ready for you to edit.

like image 32
ellimist Avatar answered Sep 24 '22 16:09

ellimist