vscode-open-in-vim icon indicating copy to clipboard operation
vscode-open-in-vim copied to clipboard

Doesn't seem to work with Linux Snap package

Open farzadmf opened this issue 5 years ago • 8 comments

Hi,

I really like your extension, and I use it to open a file in Gvim:

"open-in-vim.openMethod": "gvim"

but there seems to be a problem with the vscode installed throught snap on Ubuntu 18.10. When I select the command "Open in Vim", nothing happens.

Do you know why that's happening, and if it can be solved?

Thank you

farzadmf avatar Apr 08 '19 04:04 farzadmf

Hm. I'd expect it to at least display an error message if something goes wrong. Does it work for other open methods, like integrated-terminal?

Also, is it perhaps an unnofficial/old snap of vscode? I saw a blurb about migrating vscode snaps:

Microsoft is now publishing an official snap of Visual Studio Code, you should migrate to it using these commands:

snap remove vscode
snap install code --classic

(https://snapcraft.io/vscode)

jonsmithers avatar Apr 08 '19 06:04 jonsmithers

@jonsmithers Yes, it works with integrated-terminal, and also I'm using the official snap package.

I guess it could be due to a permission issue or something because of how snap packages are in a sandbox, but that's just a guess.

I tried in another system (a VirtualBox guest) with the same configuration as the other system, and I saw this error message; maybe it would be helpful: image

farzadmf avatar Apr 08 '19 15:04 farzadmf

That's really interesting. I'm travelling at the moment and have really spotty internet, so it might be a few days before I can try the snap for myself.

Presumably running gvim path/to/file "+call cursor(1, 2)" by itself from the terminal works fine.

jonsmithers avatar Apr 09 '19 21:04 jonsmithers

It's OK. Take a look whenever you have time.

Also, I'm not sure if I'm missing something here, but when I run the command you mentioned, I get an error, and the terminal ends up showing vim in terminal and not Gvim, this is what I see: image

farzadmf avatar Apr 10 '19 03:04 farzadmf

Oh wow. That seems to suggest that this is an issue with gvim. I have some ideas for random things to try:

  • If you just run gvim my-packages.txt (without "+call cursor(1, 2)"), it runs normally, right?
    • If so, try running gvim my-packages.txt -c "call cursor(1, 2)" to see if it's any different? This is supposed to be equivalent to gvim my-packages.txt "+call cursor(1, 2)".
  • Can you repeat the crash in a normal Terminal application, outside of vscode? (maybe it's a snap permission issue like you said)
  • What does gvim --version | head -n 2 say? I have version 8.1, with included patches 1-956, and it doesn't crash. If yours is more recent, maybe we should look into making a bug report with vim.

(As a side note, it would be nice if this open-in-vim plugin detected non-zero exits so that an issue like this doesn't unfold as a silent failure.)

jonsmithers avatar Apr 11 '19 07:04 jonsmithers

Sorry @jonsmithers for the late reply, I tried a few things you suggested and:

  • Running gvim my-packages.txt in VSCode terminal: image

  • Running gvim my-packages.txt -c "call cursor(1, 2)": image

  • Of course in normal terminal, it's totally fine and running gvim my-packages.txt opens Gvim

  • Getting the version: image

Any ideas?

farzadmf avatar Apr 13 '19 22:04 farzadmf

Thanks for helping with all this experimentation. I feel fairly confident you are right about this being a snap permission issue. I was able to finally install the snap on Fedora and I can reproduce the issue myself too. I think the best place for further investigation is on vscode's side. I went ahead and made an issue there. Feel free to add anything I might have missed.

jonsmithers avatar Apr 15 '19 08:04 jonsmithers

Thank you @jonsmithers for creating that issue; let's see what happens there :)

farzadmf avatar Apr 16 '19 12:04 farzadmf