microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.38k stars 29.32k forks source link

Opening file from right-click ends with a wrong file name #22883

Closed detlefm closed 7 years ago

detlefm commented 7 years ago

Steps to Reproduce:

  1. Create a text file like t.txt with echo "Hello world" > t.txt (for me it was ~/home/bart/t.txt)
  2. Open Explorer and open with right click this file
  3. VS Code creates a new file under ~/file:// for me was ~/file:/home/bart
bpasero commented 7 years ago

@detlefm what happens when you try the same from the command line?

@Tyriar this seems to be an issue with the desktop integration?

Tyriar commented 7 years ago

@detlefm what distro are you using? Also I don't believe VS Code attempts to install explorer integration, did you follow a tutorial to do this or something?

detlefm commented 7 years ago

I have made a video, so you can see what going on.

https://1drv.ms/v/s!AtB7LG8L7-PfjsEj1S81YzPTqXu5LQ

From the terminal: /usr/share/code/code --unity-launch t1.txt and /usr/share/code/code t1.txt works fine.

But, when I look at the recent files list (see attachment) then there are entries like ~/file:/home/bart/t1.txt The "file:" makes the problem, I get the same pattern when I call from terminal

/usr/share/code/code file://home/bart/t2.txt

  1. A folder "file:/home/bart/" is created with the file t2.txt
  2. In the recent file list I get an entry with ~/file:/home/bart/t2.txt

I think the PCManFM 1.2.4 from lubuntu 16.04 calls vscode with the file:// prefix. I don't know if this is a behavior only of PCManFM or also from other Linux / Mac Explorers.

2017-03-20 17:30 GMT+01:00 Benjamin Pasero notifications@github.com:

@detlefm https://github.com/detlefm what happens when you try the same from the command line?

@Tyriar https://github.com/Tyriar this seems to be an issue with the desktop integration?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/vscode/issues/22883#issuecomment-287815967, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Slpis4JTUwIXMYyd8qzLG--BTQlwEks5rnqmWgaJpZM4Mihko .

detlefm commented 7 years ago

I made some tests on other Ubuntu derivatives (all from 16.04 Ubuntu) and wrote a small Gtk Gui to display the argument. All work fine with VS Code: Thunar / Xubuntu -> ok, files / Ubuntu -> ok, showarg.zip

Nemo / Linux Mint -> ok

Only pcmanfm on Lubuntu expands to file:///home// when calling from "open with" right-click. Atom deals correct with this "file://" prefix and opens the correct file. VS code fails. I attach my Gtk test program (sorry - I have only very limited knowledge of Gui development on Linux, so I borrow the code from a GTK tutorial).

Tyriar commented 7 years ago

Something's wrong with the video upload

image

detlefm commented 7 years ago

Ok, lets try Dropbox - from my side all looks fine also for Onedrive - but.

https://www.dropbox.com/s/o6mhi6ifmdf6236/VSCode_20-03-2017%2015-29-00.mp4?dl=0

2017-03-21 19:35 GMT+01:00 Daniel Imms notifications@github.com:

Something's wrong with the video upload

[image: image] https://cloud.githubusercontent.com/assets/2193314/24164281/5e938ada-0e2a-11e7-9dc8-2222f4913045.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/vscode/issues/22883#issuecomment-288176821, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-SlgOuNpzyJJ_9K-AwgEwYK6iXkrljks5roBhrgaJpZM4Mihko .

Tyriar commented 7 years ago

@bpasero something weird is going on in that video:

  1. Open /home/bart/t.txt in VS Code, a new named file opens
  2. Save file, a file is created at /home/bart/file:/home/bart/t.txt

I would guess it's related to loading of the resources since the correct path seems to be there, it's just being prefixed with the cwd.

detlefm commented 7 years ago

I am not sure if you read my comment in the issue I added 8 hours before.

What I see it is related to pcmanfm. Thunar, files, and nemo working fine.

First I tried VSCode on Xubuntu, Mint and Ubuntu: No problems.

Second I wrote a small GUI to see what the filemanager provides as file argument.

It was possible to see that pcmanfm calls vscode with a prefix of "file://" to /home//

Here my comment: to the issue.

I made some tests on other Ubuntu derivatives (all from 16.04 Ubuntu) and wrote a small Gtk Gui to display the argument. All work fine with VS Code: Thunar / Xubuntu -> ok, files / Ubuntu -> ok, showarg.zip https://github.com/Microsoft/vscode/files/858346/showarg.zip

Nemo / Linux Mint -> ok

Only pcmanfm on Lubuntu expands to file:///home// when calling from "open with" right-click. Atom deals correct with this "file://" prefix and opens the correct file. VS code fails. I attach my Gtk test program (sorry - I have only very limited knowledge of Gui development on Linux, so I borrow the code from a GTK tutorial).


2017-03-21 22:54 GMT+01:00 Daniel Imms notifications@github.com:

@bpasero https://github.com/bpasero something weird is going on in that video:

  1. Open /home/bart/t.txt in VS Code, a new named file opens
  2. Save file, a file is created at /home/bart/file:/home/bart/t.txt

I would guess it's related to loading of the resources since the correct path seems to be there, it's just being prefixed with the cwd.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/vscode/issues/22883#issuecomment-288231371, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-SlvMZ8f924rBTY-NUkduKRewRI3Itks5roEcmgaJpZM4Mihko .

Tyriar commented 7 years ago

@detlefm yep, just summarizing the issue for @bpasero

vscodebot[bot] commented 7 years ago

This issue has been closed automatically because it needs more information and has not had recent activity. Please refer to our guidelines for filing issues. Thank you for your contributions.