VS Code doesn't save .ipynb files in the open path - visual-studio-code

So I have started using Jupyter Notebooks in VS Code but have run into the following problem: when I create a file via the terminal it doesn't save it in the directory from which the command was run and instead it creates it in the directory in which a file was last opened (in VS Code).
Example: the terminal is currently open in C:...\programs and so I use code test.ipynb. However, instead of creating a file there, it creates it in C:...\programs\files since the last file I opened manually in VS Code was from there.
(As a note, when doing this with .py files everything works perfectly.)

Related

VS Code keeps making copies of my Jupyter Notebooks

I have a new installation of VS Code 1.62.3
When I open .ipynb files that were created in Jupyter Notebook and run the first piece of code, it keeps creating a second copy of the file with a hexidecimal name as a postfix.
Here is a screenshot of what it looks like:
This doesn't happen when I create the file in VS Code, only those created in Jupyter Lab.
Does anyone know why this is happening or how I can stop this?
Thank you

Open file from integrated terminal in VS Code

I have VS Code setup with WSL on my Windows 10 machine. I am trying to find the command I can use to open an existing file from the integrated terminal in the current VS Code window.
I tried code filename, which launches a new VS Code window. I tried with code -r filename, but it also launches a new window.
Is there a way to quickly open a file when I'm focussed on the terminal?
As of version 1.43.1, this appears to now work as expected, without additional add ons.

Opening a specific folder using PowerShell

I am trying to create a workspace in Visual Studio Code using PowerShell. However, the code . command is not working the way I need it to. I have created a path variable in the following location: AppData\Local\Programs\Microsoft VS Code\bin. However, this only works when code . is the first command I run which opens a huge workspace. When I try to cd into specific folders and then use the code . command I get an error that says the system cannot find the path specified.

Opening local folders in VS Code from WSL

I use WSL as my main command-line for all my git interactions.
I have the habit to open VS Code in the current folder by typing code . &
Recently VS Code started to open the folder as a remote folder instead of as a local folder.
The same thing happens even if I pass a full windows path like
code x:\\repos\\test. Instead of opening the specified folder, a new empty file is opened at ./x:/repos/test

How to open multiples files in one Code instance from command line?

If I open a file in Visual Studio Code from the command line or from within File Explorer, each file will open in a separate Code instance. Is there a way to make them all open in the same instance? I.e. add them all to the 'Working Files' list?
Upcoming version will have a new option files.openInNewWindow which you can set to off to always open files into the last active instance. This is then identical to starting VS Code with the -r option but is much nicer to use (e.g. when you open a file from the desktop).
Update for our VS Code 1.0 release:
The setting is available as window.openFilesInNewWindow
You can use the command line option of -r or --reuse-window to assure it opens in the last active VS Code window
You can review the other options here
code Folder1/File1.txt Folder2/File2.java Folder3/File3.css
This command opens three files in one instance of the editor. All files are going to be added to the working files list.
This even works with much more files in the parameter list.