code-server icon indicating copy to clipboard operation
code-server copied to clipboard

[Bug]: vscodevim extension broken

Open f0x52 opened this issue 3 years ago • 34 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS/Web Information

  • Web Browser: Firefox, Chrome (PWA)
  • Local OS: Arch Linux
  • Remote OS: NixOS Linux
  • Remote Architecture: amd64
  • code-server --version: 4.0.1

Steps to Reproduce

Install code-server 4.0.1, install vscodevim.vim either through GUI or CLI, reload, extension does not work

Expected

vscodevim.vim extension works

Actual

With code-server 4.0.1, vscodevim gave an error that it was disabled because it was incompatible. However upon reinstalling, no such error comes up, but it does fail to load. This happens when installing through the GUI, and with code-server --install-extension.

Going back to 3.12.0 (my easiest option under NixOS), vscodevim works without issue again.

Logs

No response

Screenshot/Video

No response

Does this issue happen in VS Code?

  • [X] I cannot reproduce this in VS Code.

Are you accessing code-server over HTTPS?

  • [X] I am using HTTPS.

Notes

No response

f0x52 avatar Feb 04 '22 21:02 f0x52

This doesn't seem to be an issue in 4.0.2. Please give that a try!

image

jsjoeio avatar Feb 04 '22 22:02 jsjoeio

I'm on 4.0.2 now, the same issue persists. It installs, but doesn't actually work. The status bar does show "Activating Extensions..." after every key combo, but nothing vim-related happens

f0x52 avatar Feb 04 '22 23:02 f0x52

there are no errors in the browser devtools. Issue is also reproducible with the extension directory copied over from my local VSCode

f0x52 avatar Feb 04 '22 23:02 f0x52

@f0x52 hmm...I'm not sure what I can do to help since I can't reproduce it myself. What version of the extension are you usng?

jsjoeio avatar Feb 07 '22 20:02 jsjoeio

To make sure it's reproducible I got a clean code-server install, 4.0.2. Installed on NixOS inside a container

Installing the vscodevim.vim through the web manager uses v1.21.10. Installing the extension seems to work without issue, but it doesn't actually do anything. It should change the cursor to a block shape, which doesn't happen, and typing is completely blocked but without any way to switch modes like normal vim/with a working extension. Any key input does trigger an "Activating extension..." in the activity bar, but nothing else happens, maybe there are some logs I could access, that I wasn't able to find?

f0x52 avatar Feb 07 '22 20:02 f0x52

@f0x52 Hmm...I have two suspicious. Either another extension is conflicting or there is a setting that is conflicting.

Can you share your settings.json here? And can you try with only this extension?

jsjoeio avatar Feb 07 '22 23:02 jsjoeio

My test was with a completely untouched code-server install, no other extensions, no custom settings, and no changes in settings.json does the vim extension actually work when you try it? Maybe the newer vs code version broke something

f0x52 avatar Feb 07 '22 23:02 f0x52

Ah, okay, you're 3 steps ahead of me.

Yes! I'm using code-server 4.0.2 on macOS right now and it works as expected 🤷‍♂️

Video

https://user-images.githubusercontent.com/3806031/152889968-29f55486-805b-4dd7-b6e2-9120b88f8290.mov

I'm guessing you've tried installing the extension and then restarting code-server?

@code-asher any ideas on how else we can debug this?

jsjoeio avatar Feb 07 '22 23:02 jsjoeio

really weird, I'll try reproducing the issues on a local install tomorrow

f0x52 avatar Feb 07 '22 23:02 f0x52

Sounds good! Keep me posted. We'll get this sorted together, can't code without Vim in VS Code/code-server

jsjoeio avatar Feb 08 '22 16:02 jsjoeio

ahh im not sure if (and if i did, how..) I missed this, but the console lists INFO Request to 'https://open-vsx.org/vscode/asset/vscodevim/vim/1.22.1/Microsoft.VisualStudio.Code.WebResources/extension' failed with status code 404 So it's now seemingly failing to fetch the extension at all. Might be related to 1.22.1 just releasing though, 8 hours ago

f0x52 avatar Feb 08 '22 21:02 f0x52

I also started to have this issue today and reverting to vscodevim.vim v1.21.10 seems to fix it for me. I guess it is probably related to the new 1.22.0/1 release.

benlimpa avatar Feb 08 '22 21:02 benlimpa

@benlimpa same! I think it's the new release. If you take a look at the browser console, it's missing a module called child_process. My guess is isn't either not including that in the release package or it's trying to access a Node-only module but can't since it's now considered a web extension (in code-server).

Reverting to v1.21.10 works for me.

Upstream: here's the module it can't find: https://github.com/VSCodeVim/Vim/blob/master/src/util/child_process.ts

And this relies on Node APIs which aren't available in web extensions.

This is the only maybe related thing I see: https://github.com/VSCodeVim/Vim/pull/7252

jsjoeio avatar Feb 08 '22 21:02 jsjoeio

reverting to v1.21.10 from the web gui does bring up "This extension is disabled because it is not supported in code-server for the Web. Learn More"

f0x52 avatar Feb 08 '22 21:02 f0x52

@f0x52 so strange. I just did it and it works for me?

image

I wonder if it's an environment issue for you

jsjoeio avatar Feb 08 '22 21:02 jsjoeio

I had to install v1.21.10 from a local copy because it seems the open-vsx api changed/broke for the older versions as well 404 on https://open-vsx.org/vscode/asset/vscodevim/vim/1.21.10/Microsoft.VisualStudio.Code.WebResources/extension

I guess it doesn't matter that it's already in the local extensions folder, it will always try to install it anew on the browser (clean session) and something might be going wrong there?

Other issue I see is a 404 on https://example.com/static/stable/out/vs/workbench/services/extensions/worker/httpsWebWorkerExtensionHostIframe.html?&vscodeWebWorkerExtHostId=bfce0625-4d3b-437b-87f5-eef1507f8d6e

f0x52 avatar Feb 08 '22 21:02 f0x52

After some patches related to rimraf in the vscode fork, I do have a working local build based on main, with a working vim extension. Interesting difference is that the working code-server requests https://open-vsx.org/vscode/asset/vscodevim/vim/1.21.10/Microsoft.VisualStudio.Code.WebResources/extension/package.json whereas the 4.0.2 release gets a 404 on https://open-vsx.org/vscode/asset/vscodevim/vim/1.21.10/Microsoft.VisualStudio.Code.WebResources/extension (which is missing the /package.json at the end)

f0x52 avatar Feb 09 '22 16:02 f0x52

Very interesting observation @f0x52 🤔

I don't think we changed anything with how extensions are handled in 4.0.2. Anything come to mind @code-asher?

jsjoeio avatar Feb 09 '22 20:02 jsjoeio

/static/stable/out/vs/workbench/services/extensions/worker/httpsWebWorkerExtensionHostIframe.html missing seems to indeed be the missing piece.

It's the only asset that gets loaded from static/stable/, which I'll have to dig further into why that's getting set, and only set for that specific URL

f0x52 avatar Feb 09 '22 22:02 f0x52

the stable comes from this._productService.quality being set, but is somehow the only route affected by this (and whatever code handles the routing for those assets, doesn't add the quality..)

f0x52 avatar Feb 10 '22 12:02 f0x52

Very very interesting find. I wonder if we need to be including that 🤔

I see it here: https://github.com/code-asher/vscode/blob/main/build/gulpfile.vscode.web.js#L48-L49

But maybe there's another place we need to add/include it.

@code-asher does any of this ring familiar?

jsjoeio avatar Feb 10 '22 16:02 jsjoeio

The URL I get for that (on 4.0.2) is /static/out/vs/workbench/services/extensions/worker/httpsWebWorkerExtensionHostIframe.html so it does seem like there is an extra stable in there somehow which would explain the 404.

code-asher avatar Feb 16 '22 18:02 code-asher

I do recall being in this code before. VS Code uses the web endpoint URL template if the commit and quality is set otherwise it just prepends /quality and/or /commit if they exist (this is why I added the quality in our build process so it would use our template instead of prepending /commit).

https://github.com/coder/vscode/blob/96e241330d9c44b64897c1e5031e00aa894103db/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts#L88-L131

So perhaps commit is not being set in the product.json resulting in the URL being prepended with /stable.

code-asher avatar Feb 16 '22 18:02 code-asher

Hello! Just curious if there have been any updates to this issue? Just giving this thread a little bump for love. :)

majordoobie avatar Mar 29 '22 01:03 majordoobie

@majordoobie this should be fixed! I tested on 4.2.0 and didn't have any issues. But I'm also using v1.21.10 of the VSCodeVim extension though.

Video

https://user-images.githubusercontent.com/3806031/160660536-8df0b3c3-51a6-4108-a40e-e90facc97824.mov

jsjoeio avatar Mar 29 '22 16:03 jsjoeio

Sorry it took so long to try this out; got busy with work!

I installed the version you mentioned and I get this: image

Did you get a similar issue?

majordoobie avatar Apr 04 '22 00:04 majordoobie

@majordoobie no, see the video above!

jsjoeio avatar Apr 04 '22 20:04 jsjoeio

I can confirm what @majordoobie sees.

I'm running code-server 4.2.0 installed from Conda. I downloaded the extension v1.21.10 and installed it from the VSIX using the UI.

When I try to install it from the extensions pane I get the following error in the log (window)

[2022-04-07 16:41:18.411] [window] [error] Error: Cannot find the package.json from the location 'http://remote/web-extension-resource/open-vsx.org/vscode/asset/vscodevim/vim/1.22.2/Microsoft.VisualStudio.Code.WebResources/extension'. Failed to fetch
    at x.toWebExtension (http://127.0.0.1:8888/code-server/static/out/vs/workbench/workbench.web.main.js:3053:111476)
    at async x.addExtensionFromGallery (http://127.0.0.1:8888/code-server/static/out/vs/workbench/workbench.web.main.js:3053:109348)
    at async n.doRun (http://127.0.0.1:8888/code-server/static/out/vs/workbench/workbench.web.main.js:3054:4475)

~~After testing some different versions I've found one that works, v1.21.7.~~ It was not working properly.

What I find weird is that once I install my extension it goes under the REMOTE - INSTALLED pane while for you, @jsjoeio, it goes under BROWSER - INSTALLED. I think it is related to the different behaviours that we see.

avsthiago avatar Apr 07 '22 14:04 avsthiago

I managed to get vim v1.22.2 working on code-server 4.2.0 by following these steps.

Command Palette (F1) Select the option: Developer: Install Web Extension... Paste the URL https://open-vsx.org/vscode/asset/vscodevim/vim/1.22.2/Microsoft.VisualStudio.Code.WebResources/extension Click install

avsthiago avatar Apr 08 '22 14:04 avsthiago

I'm using ubuntu docker and vim extension is not working with code-server_4.2.0_amd64.deb

This extension is disabled because it is not supported in Code - OSS for the Web. 

I've tried 5 versions of vim extensions, but nothing worked:

vscodevim.vim-1.21.10.vsix  
vscodevim.vim-1.21.9.vsix  
vscodevim.vim-1.22.0.vsix  
vscodevim.vim-1.22.1.vsix  
vscodevim.vim-1.22.2.vsix

How I installed:

#!/bin/sh
for f in *.vsix
do
    echo "install $f"
    bsdtar -xvf $f - extension
    NAME="${f%.*}"
    mv extension /root/.local/share/code-server/extensions/$NAME
    echo "$NAME installed!"
done

I've also tried:

code-server --install-extension

I've successfully installed C/C++ extension, but failed on Vim extension.

tony-jinwoo-ahn avatar Apr 10 '22 04:04 tony-jinwoo-ahn