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

Different behaviors when open symlink folder in VS Code #74104

Closed
jdneo opened this issue May 22, 2019 · 16 comments
Closed

Different behaviors when open symlink folder in VS Code #74104

jdneo opened this issue May 22, 2019 · 16 comments
Assignees
Labels
linux Issues with VS Code on Linux *out-of-scope Posted issue is not in scope of VS Code upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@jdneo
Copy link
Member

jdneo commented May 22, 2019

  • VSCode Version: 1.34.0 & 1.35.0 - insider
  • OS Version: MacOS Mojave 10.14.5 & Fedora Workstation 30

Steps to Reproduce:

  1. Prepare a folder as a workspace folder in VS Code, let's name it as demo
  2. Generate a symlink for that folder: ln -s demo demolink
  3. Open the symlink demolink in VS Code

Behavior on MacOS Mojave

The VS Code will open the folder demo as the workspace folder.

Screen Shot 2019-05-22 at 1 23 15 PM

Behavior on Fedora

The VS Code will open the folder demolink as the workspace folder.

Screen Shot 2019-05-22 at 1 22 18 PM

Because of the differences, some APIs calling behavior will become different as well. For example, when calling workspace.getWorkspaceFolder(uri).

@bpasero bpasero added this to the May 2019 milestone May 23, 2019
@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities labels May 23, 2019
@bpasero
Copy link
Member

bpasero commented May 23, 2019

there should be no differences, help wanted to investigate + fix if possible 👍

@bpasero
Copy link
Member

bpasero commented May 25, 2019

@jdneo I cannot reproduce, here is what I did

  • followed your instructions how to get the linked folder
  • from the command line type code demolink
  • result:

image

@bpasero bpasero added info-needed Issue requires more information from poster and removed bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities labels May 25, 2019
@bpasero bpasero removed this from the May 2019 milestone May 25, 2019
@jdneo
Copy link
Member Author

jdneo commented May 26, 2019

@bpasero it seems that you are using macos? Could you please try it on Fedora? I can repro it on Fedora 30

@bpasero
Copy link
Member

bpasero commented May 26, 2019

@jdneo I do not see an issue with that, you are asking Code to open the link and it does. Do you expect to follow the symlink when opening?

@hunghw
Copy link
Contributor

hunghw commented May 27, 2019

I can reproduce it. And I get the same result while opening files.

Step to reproduce:

  1. touch demo.txt
  2. ln -s demo.txt demolink.txt
  3. open both of these files in vscode insider
    In debian: the file name on the editor will show demo.txt and demolink.txt respectively.
    In macos: both of these will show demo.txt
  4. mv demolink.txt folder/
  5. Open the demolink.txt in folder
    The file name will show demolink.txt in macos.

The issue might happen on macos.

@jdneo
Copy link
Member Author

jdneo commented May 28, 2019

Hi @bpasero,

Sorry for the late reply. I was on vacation before.

Regarding the issue, actually, I'm not sure what's the right behavior should be. But the thing I've observed is that the name of the opened folder is not the same on Mac and Linux. Please let me know anything I can help to help you reproduce the issue.

@bpasero bpasero added this to the May 2019 milestone May 28, 2019
@bpasero
Copy link
Member

bpasero commented May 28, 2019

The right behaviour in VSCode is to not follow the symlink but actually open it as instructed by the user. However this probably also depends on how the file was opened, e.g. from a native dialog or not.

@hwhung0111 @jdneo thanks for providing steps, but you are missing to tell me how you actually open the file. Just to give an example, here are various ways how you can open files in VSCode:

  • from the command line directly
  • from File > Open
  • from the VSCode explorer by clicking on it
  • via quick open when typing the name of the file

@bpasero bpasero removed this from the May 2019 milestone May 28, 2019
@jdneo
Copy link
Member Author

jdneo commented May 28, 2019

I see. For me, I'm using File > Open to open the symlink.

@bpasero bpasero added linux Issues with VS Code on Linux upstream Issue identified as 'upstream' component related (exists outside of VS Code) and removed info-needed Issue requires more information from poster labels May 28, 2019
@hunghw
Copy link
Contributor

hunghw commented May 28, 2019

I also open from File > Open. For me, macos don't have the same behavior even I open the same symlink.

@vscodebot vscodebot bot added the *out-of-scope Posted issue is not in scope of VS Code label Oct 15, 2019
@vscodebot
Copy link

vscodebot bot commented Oct 15, 2019

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@jdneo
Copy link
Member Author

jdneo commented Nov 22, 2019

Hi @bpasero,

Can we re-open this issue? I have several users who have encountered the same problem. It would be great if VS Code can fix this.

@bpasero
Copy link
Member

bpasero commented Dec 5, 2019

I do not think VSCode can do anything because we get the path from the system dialog and do nothing with it. I suspect platform differences here with the path we get back from the system dialog via Electron.

@Spongman
Copy link

this is a disaster, it completely messes up the git panel. .gitignore handling is broken, all the changed paths are listed as absolute paths. unusable.

@amgodoi
Copy link

amgodoi commented Jul 5, 2022

Hi @jdneo

As a workaround you could open the folder from command line:

$ code .

I got the same behavior described for @bpasero and it is system dialog dependent. My system is using "GtkFileChooserDialog" to open files and directories ... I have a lot o problems with other applications too. I am Using ubuntu 22.04 with gtk4 and I think this is the problem ... gtk4 is not working properly yet.

@zachary-wang12
Copy link

zachary-wang12 commented Jan 3, 2024

The same issue happened on

Linux Debian 6.1.67-1 (2023-12-12) x86_64 GNU/Linux

I'm using vscode tunnel to develop java project.

The application could run as formal, but when test, it shows the error.

@zachary-wang12
Copy link

zachary-wang12 commented Jan 3, 2024

The same issue happened on

Linux code-capsule 6.1.0-16-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.67-1 (2023-12-12) x86_64 GNU/Linux

I'm using vscode tunnel to develop java project.

The application could run as formal, but when test, it shows the error.

I found an interesting thing during duplicating this issue:

  • Server:

    • Vscode CLI 1.85.1 (commitee: 0ee08df)
    • OS Version: Debian 6.1.67-1 (2023-12-12) x86_64 GNU/Linux
    • Test Runner for Java: v0.40.1
  • Test Client1:

    • Client: Microsoft Edge (120.0.2210.91 (64 bits))
    • OS Version: Windows 11 Professional 23H2
  • Test Client2:

    • Client: Visual Studio Code 1.85.1 (commitee: 0ee08df)
    • OS Version: Same as test client 1

Tested project is a simple project built by spring initializr and just add spring web as dependency.

There is no error shown when I connect the tunnel from test client 2 (using VS Code), and all things going as normal. However, when I connect the tunnel from test client 1 (using vscode.dev/tunnel/my-tunnel), this issue happened.

BTW, the test project wasn't use symlink, but directly opened by:

  • File -> Open Folder...

Hope these info could help someone to figure this out~ @bpasero @jdneo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linux Issues with VS Code on Linux *out-of-scope Posted issue is not in scope of VS Code upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

6 participants