Parham Salamati
Parham Salamati

Reputation: 63

How to open a file in the same VSCode instance using terminal

VS Code Version: 1.87.2 OS Version: Windows 10 22H2 19045.4046

I'm having a weird issue trying to open my files from terminal in VSCode on windows. As far as I know using -r should force opening a file in the same instance of VSCode, but no matter how my settings is setup I still get a new instance opening up every time!

Already googled solutions and searched through stackoverflow, tried both "window.openFilesInNewWindow": "off" "window.openWithoutArgumentsInNewWindow": "off" Doesn't seem to have any effects on my issue. Am I missing something?

note: working on a Django project repo if it helps.

Steps to Reproduce:

Any suggestions would be much appreciated

Upvotes: 2

Views: 116

Answers (2)

Tripp Kinetics
Tripp Kinetics

Reputation: 5439

If you start the initial VS Code window using the Terminal window, then subsequent calls to the code.exe executable from the same window will open the new file in the same window. So, just make sure to start your session from the Windows Terminal instead of from Windows Explorer, and Bob's your uncle.

Upvotes: 1

Mark TeaBot
Mark TeaBot

Reputation: 29

I do not understand exactly what you want to do. Here are some of my suggestions:

Running python code in the vsc terminal?

python your_file.py

Running a pip command?

python -m pip install -r requirements.txt

The terminal does not have a -r flag. This is also true for Python.

Upvotes: -1

Related Questions