Programmatically opening a file from the terminal command line in one window/instance may in fact open in a different window/instance #169890
Open
Description
opened on Dec 23, 2022
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.74.2 e8a3071 x64
- OS Version: Windows 10 / Ubuntu 22.04.1 LTS
Steps to Reproduce:
- Remote session should be on a machine that can execute delayed commands. I use the
sleep
command in my example.
- Open VSC
- Connect to a remote session (Session 1)
- Open a second window or instance of VSC
- Connect the window to the same remote machine (Session 2)
- Go to Session 1
- Create a new or use an existing file (for new files, roll head on the keyboard for entropy)
- Close the file
- Go to the terminal
- Execute
sleep X ; code <filename(s)>
- for X pick a reasonable amount of seconds to allow the tester to switch windows - Switch windows
- Watch the file from the other window open in the current window
- ??
- Profit!
Notes:
- Testing showed there is no difference between a "fully loaded" session and an "empty" window with no preselected workspace or folders.
- There was no difference between running just
code
orcode --wait
. - This only happens for files that have not been opened in an existing window.
- I came across this when I briefly switched to another project window as I was running a script that automatically opens files that need my attention.
- While migrating a React project from JS to TS, I wrote a script that runs eslint with a custom formatter and then uses the generated file list to sequentially open files based on descending error count. It uses
code --wait
.
P.S. To whom it may concern, while this bug report is serious, I hope this bug and my write up are bringing a little joy. Happy holidays!
Activity