Skip to content

Programmatically opening a file from the terminal command line in one window/instance may in fact open in a different window/instance #169890

Open
@TyIsI

Description

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.
  1. Open VSC
  2. Connect to a remote session (Session 1)
  3. Open a second window or instance of VSC
  4. Connect the window to the same remote machine (Session 2)
  5. Go to Session 1
  6. Create a new or use an existing file (for new files, roll head on the keyboard for entropy)
  7. Close the file
  8. Go to the terminal
  9. Execute sleep X ; code <filename(s)> - for X pick a reasonable amount of seconds to allow the tester to switch windows
  10. Switch windows
  11. Watch the file from the other window open in the current window
  12. ??
  13. 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 or code --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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionalityremoteRemote system operations issuesworkbench-cliVS Code Command line issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions