Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open remote file if local copy exists #190566

Closed
pilkjaer opened this issue Aug 16, 2023 · 2 comments
Closed

Unable to open remote file if local copy exists #190566

pilkjaer opened this issue Aug 16, 2023 · 2 comments
Assignees

Comments

@pilkjaer
Copy link

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.80.2
  • OS Version: Win10

I use VS Code via remote connection. I connect from a Windows machine to a Linux machine. Then I SSH from a Linux machine to another Linux machine.
If I have a local file and try to modify it, I'm unable to open file from a server that I SSH:d to as it always open local copy of that file.

Steps to Reproduce:
0. Start remote VS code session towards server (s1).

  1. Clone a repo (r1) to a server s1.
  2. Change any file (f1).
  3. In Terminal, SHH to another server (s2).
  4. Clone same repo r1 to that server s2 in the same location as on server s1.
  5. List file (f1) on server s2.
  6. Ctrl+click on that file name (f1).
  7. Observer that editor will open f1 version from s1 (in other words modified version of the file f1).

There seems to be similar issue when you do the following:

  1. Start VS code on a Windows machine
  2. SSH to a Linux server
  3. try to Click-open any file.
  4. You will get an error "no matching results" with Linux path to a file being mangled in a Windows way

If you have a Linux machine on which you run VS Code, cases one and two will be the same.

In this second case I get a clear error as file is not present locally (due to Linux vs Windows file path differences). In the first example file being opened is a local copy of that file as location of the file is the same both locally and on a remote server (as both machines have same file system type). This can lead to confusion as user will be looking at the wrong version of the file. I think an error/warning should be displayed to the user to ensure that it's clear that requested file can't be open. Currently you get an editor and path in the tab name looks fine. In reality it's local copy of the file and not from a remote server.

There probably should be a way to open file from a remote server in the current window.

@vscodenpa
Copy link

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.81.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@roblourens
Copy link
Member

How are you expecting that vscode would open the folder from s2 when s2 is not open in the window?

The terminal link detection can only guess at which file a path segment refers to, and it only knows about the workspace open in the vscode window, it doesn't know that you ran ssh and connected to a different machine.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 27, 2024
@aiday-mar aiday-mar added this to the December / January 2024 milestone Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants