Skip to content

VIM Extension is not working #2319

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

Closed
sangchul opened this issue Nov 17, 2020 · 26 comments
Closed

VIM Extension is not working #2319

sangchul opened this issue Nov 17, 2020 · 26 comments
Assignees
Labels
bug Something isn't working extension The issue needs to be fixed in the extension high-priority This issue needs to be resolved ASAP
Milestone

Comments

@sangchul
Copy link

sangchul commented Nov 17, 2020

  • Web Browser: NAVER Whale 2.8.108.15
  • Local OS: macOS Catalina Version 10.15.7
  • Remote OS: CentOS Linux release 7.4.1708
  • Remote Architecture: x86_64
  • code-server --version: 3.7.1 2bf91ff

It works in code-server 3.6.0, but after I upgraded it 3.7.1, keymaps of VIM are not working. I tried other browsers like safari or firefox, they don't work as well. I tried 3.6.2, 3.6.1, none of them are working.. vim extension is only working at 3.6.0 . The version of my vim extension is 1.6, it is the latest and I tried to run code-server with --log trace option to get an information of extensions, there are nothing worth.

please let me know how to fix it?

@vnijs
Copy link

vnijs commented Nov 25, 2020

I just upgraded to 3.7.3 and the VIM extension 1.16.0 seems to be working fine. Can you try the new version?

@sangchul
Copy link
Author

I tried the new version 3.7.3.. but it is still not working... When I launched vscode 3.7.3 in my browser, "activate extensions" message was shown several times and "Error loading webview: Service Workers are not enabled in browser. Webviews will not work." pop-up was also shown.

@code-asher
Copy link
Member

code-asher commented Nov 25, 2020

My bad for leaving this so long; for some reason my email responses to this thread aren't getting posted. 😕

Could you post the browser console logs?

@sangchul
Copy link
Author

Uncaught TypeError: trustedTypes.createPolicy is not a function
    at e.load (loader.js:724)
    at e.load (loader.js:606)
    at o (loader.js:1620)
    at s._loadModule (loader.js:1632)
    at s._resolve (loader.js:1716)
    at s.defineModule (loader.js:1367)
    at o (loader.js:1835)
    at extensionHostWorkerMain.js:21
    at extensionHostWorkerMain.js:6

It is a log from 3.7.3... but there is no log like it in 3.6.0... I think it might be a reason of the extension not working.

@pojntfx
Copy link

pojntfx commented Nov 26, 2020

Screenshot 2020-11-26 at 12 45 33
Screenshot 2020-11-26 at 12 45 49

I just tested the Vim extension on the newest version (v3.7.3) as well, it seems to be working. I do however have to clean caches in the browser from time to time or I'd not be able to exit insert mode and command 'toggleVim' not found. would be thrown.

@code-asher
Copy link
Member

@sangchul You might be right; VS Code calls trustedTypes.createPolicy() in a few places and perhaps that's not implemented in this browser? Does it work for you in other browsers?

@pojntfx Interesting, I have no idea what might be causing an inability to exit insert mode but I'll poke around and see if I can replicate.

@sangchul
Copy link
Author

sangchul commented Dec 1, 2020

@code-asher Oh... I downloaded and tried the latest version of chrome browser, it works! Because Naver whale browser I've used is based on the chromium project, so I expected it would have worked as the same with the chrome. I'll report this problem to Whale browser dev team.

Thanks for your help.

@csaska
Copy link
Contributor

csaska commented Dec 2, 2020

I have issues with the latest Chrome Version 87.0.4280.67 using code-server v3.7.2. I would try v3.7.3 or later but I am running on ppc and those releases do not work on ppc.

Here's the behavior I see.

After initiallly connecting via Chrome browser, the VIM extension works perfectly. As soon as I reload the page, the VIM extension now causes all keyboard input when editing a file to have no effect. Every keyboard click pops up an "Activating Extensions" message in the footer of the app.

The only way to regain keyboard input functionality is to disable the VIM extension. Re-enabling the VIM extension after this will again stop keyboard input from working. I have to continually quit my browser and/or reload code-server to get the extension to being working again.

@code-asher
Copy link
Member

code-asher commented Dec 2, 2020 via email

@csaska
Copy link
Contributor

csaska commented Dec 2, 2020

This is an example of refreshing my browser and the Vim extension not working. Here is the Chrome console log saved to a file and I attached a screenshot as well.

What I did? Connected to the service. Opened DevTools. Cleared the console log. Hit CMD + R to reload the browser.

In this example, the VIM extension did not throw any errors. In the past, I have see it throw an error regarding an uncaught future. If I see that again I'll try to get to the bottom of it with the Vim folks.

console-log.txt

register.ts:16 [Service Worker] registered
workbench.web.api.js:4746 The web worker extension host is started without an iframe sandbox!
start @ workbench.web.api.js:4746
e @ workbench.web.api.js:4632
_createInstance @ workbench.web.api.js:1675
createInstance @ workbench.web.api.js:1674
(anonymous) @ workbench.web.api.js:5170
_startExtensionHosts @ workbench.web.api.js:5170
_initialize @ workbench.web.api.js:5169
(anonymous) @ workbench.web.api.js:5179
Promise.then (async)
k @ workbench.web.api.js:5179
_createInstance @ workbench.web.api.js:1675
_createServiceInstance @ workbench.web.api.js:1677
_createServiceInstanceWithOwner @ workbench.web.api.js:1676
_createAndCacheServiceInstance @ workbench.web.api.js:1676
_getOrCreateServiceInstance @ workbench.web.api.js:1675
get @ workbench.web.api.js:1674
initLayout @ workbench.web.api.js:6692
(anonymous) @ workbench.web.api.js:6738
invokeFunction @ workbench.web.api.js:1674
startup @ workbench.web.api.js:6738
open @ workbench.web.api.js:6744
async function (async)
open @ workbench.web.api.js:6744
t.main @ workbench.web.api.js:6749
t.create @ workbench.web.api.js:7908
(anonymous) @ workbench.ts:504
(anonymous) @ workbench.ts:405
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
i @ loader.js:1649
l @ loader.js:2163
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
n @ loader.js:1810
(anonymous) @ workbench.nls.js:7
DevTools failed to load SourceMap: Could not load content for http://localhost:8080/static/a0db6723c1ef22b40d7ac0df5ac1bb9a92e4fe46/data/csaska/.config/yarn/global/node_modules/code-server/dist/pages/pages/vscode.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load SourceMap: Could not load content for http://localhost:8080/static/a0db6723c1ef22b40d7ac0df5ac1bb9a92e4fe46/data/csaska/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js.map: Load canceled due to load timeout
workbench.web.api.js:1689  INFO [remote-connection][ExtensionHost][ca9a6…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
workbench.web.api.js:1689  INFO [remote-connection][ExtensionHost][ca9a6…][reconnect] waiting for 5 seconds before reconnecting...
workbench.web.api.js:1689  INFO [remote-connection][Management   ][ac110…][reconnect] starting reconnecting loop. You can get more information with the trace log level.
workbench.web.api.js:1689  INFO [remote-connection][Management   ][ac110…][reconnect] waiting for 5 seconds before reconnecting...
workbench.web.api.js:1689  INFO [remote-connection][ExtensionHost][ca9a6…][reconnect] resolving connection...
workbench.web.api.js:1689  INFO [remote-connection][ExtensionHost][ca9a6…][reconnect] connecting to localhost:8080...
workbench.web.api.js:1689  INFO [remote-connection][Management   ][ac110…][reconnect] resolving connection...
workbench.web.api.js:1689  INFO [remote-connection][Management   ][ac110…][reconnect] connecting to localhost:8080...
workbench.web.api.js:1689  INFO [remote-connection][ExtensionHost][ca9a6…][reconnect] reconnected!
workbench.web.api.js:1689  INFO [remote-connection][Management   ][ac110…][reconnect] reconnected!

image

@csaska
Copy link
Contributor

csaska commented Dec 2, 2020

Here is an exmple of the Vim Extension working. I killed code-server instance, cleared all the logs, restarted the code-server instance, and connected. Everything works. Sorry this is confusing, I did the steps in reverse.

console-log.txt

(index):37 GET http://localhost:8080/static/a0db6723c1ef22b40d7ac0df5ac1bb9a92e4fe46/data/csaska/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/semver-umd/lib/semver-umd.js net::ERR_ABORTED 404 (Not Found)
register.ts:16 [Service Worker] registered
DevTools failed to load SourceMap: Could not load content for http://localhost:8080/static/a0db6723c1ef22b40d7ac0df5ac1bb9a92e4fe46/data/csaska/.config/yarn/global/node_modules/code-server/dist/pages/pages/vscode.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
workbench.web.api.js:4746 The web worker extension host is started without an iframe sandbox!
start @ workbench.web.api.js:4746
e @ workbench.web.api.js:4632
_createInstance @ workbench.web.api.js:1675
createInstance @ workbench.web.api.js:1674
(anonymous) @ workbench.web.api.js:5170
_startExtensionHosts @ workbench.web.api.js:5170
_initialize @ workbench.web.api.js:5169
(anonymous) @ workbench.web.api.js:5179
Promise.then (async)
k @ workbench.web.api.js:5179
_createInstance @ workbench.web.api.js:1675
_createServiceInstance @ workbench.web.api.js:1677
_createServiceInstanceWithOwner @ workbench.web.api.js:1676
_createAndCacheServiceInstance @ workbench.web.api.js:1676
_getOrCreateServiceInstance @ workbench.web.api.js:1675
get @ workbench.web.api.js:1674
initLayout @ workbench.web.api.js:6692
(anonymous) @ workbench.web.api.js:6738
invokeFunction @ workbench.web.api.js:1674
startup @ workbench.web.api.js:6738
open @ workbench.web.api.js:6744
async function (async)
open @ workbench.web.api.js:6744
t.main @ workbench.web.api.js:6749
t.create @ workbench.web.api.js:7908
(anonymous) @ workbench.ts:504
(anonymous) @ workbench.ts:405
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
i @ loader.js:1649
l @ loader.js:2163
t._invokeFactory @ loader.js:1129
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._onModuleComplete @ loader.js:1772
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
n @ loader.js:1810
(anonymous) @ workbench.nls.js:7
DevTools failed to load SourceMap: Could not load content for http://localhost:8080/static/a0db6723c1ef22b40d7ac0df5ac1bb9a92e4fe46/data/csaska/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js.map: Load canceled due to load timeout
client.js:26048 Uncaught (in promise) Error: ENOENT: no such file or directory, open '/data/csaska/.local/share/code-server/globalStorage/vscodevim.vim/.registers'
	at convert (client.js:26048)
	at Object.exports.decode (client.js:26081)
	at client.js:24648
	at client.js:26194
	at Array.forEach (<anonymous>)
	at Emitter.emit (client.js:26194)
	at Client.emitFail (client.js:24700)
	at Client.<anonymous> (client.js:24671)
	at step (client.js:22761)
	at Object.next (client.js:22742)
	at client.js:22735
	at new Promise (<anonymous>)
	at Object.__awaiter (client.js:22731)
	at Client.handleMessage (client.js:24657)
	at Client.<anonymous> (client.js:24479)
	at step (client.js:22761)
	at Object.next (client.js:22742)
	at client.js:22735
	at new Promise (<anonymous>)
	at Object.__awaiter (client.js:22731)
	at client.js:24473
	at l.fire (event.ts:587)
	at c.$onMessage (extHostNodeProxy.ts:26)
	at m._doInvokeHandler (rpcProtocol.ts:409)
	at m._invokeHandler (rpcProtocol.ts:394)
	at m._receiveRequest (rpcProtocol.ts:310)
	at m._receiveOneMessage (rpcProtocol.ts:237)
	at rpcProtocol.ts:105
	at l.fire (event.ts:587)
	at MessagePort.e.port1.onmessage (extensionHostWorker.ts:105)
convert @ client.js:26048
exports.decode @ client.js:26081
(anonymous) @ client.js:24648
(anonymous) @ client.js:26194
Emitter.emit @ client.js:26194
Client.emitFail @ client.js:24700
(anonymous) @ client.js:24671
step @ client.js:22761
(anonymous) @ client.js:22742
(anonymous) @ client.js:22735
__awaiter @ client.js:22731
Client.handleMessage @ client.js:24657
(anonymous) @ client.js:24479
step @ client.js:22761
(anonymous) @ client.js:22742
(anonymous) @ client.js:22735
__awaiter @ client.js:22731
(anonymous) @ client.js:24473
fire @ event.ts:587
$onMessage @ extHostNodeProxy.ts:26
_doInvokeHandler @ rpcProtocol.ts:409
_invokeHandler @ rpcProtocol.ts:394
_receiveRequest @ rpcProtocol.ts:310
_receiveOneMessage @ rpcProtocol.ts:237
(anonymous) @ rpcProtocol.ts:105
fire @ event.ts:587
e.port1.onmessage @ extensionHostWorker.ts:105
Promise.then (async)
loadFromDisk @ VM10:1
t.activate @ VM10:9
async function (async)
t.activate @ VM10:9
t.activate @ VM10:9
_callActivateOptional @ extHostExtensionService.ts:433
_callActivate @ extHostExtensionService.ts:422
(anonymous) @ extHostExtensionService.ts:372
Promise.then (async)
_doActivateExtension @ extHostExtensionService.ts:371
_activateExtension @ extHostExtensionService.ts:319
async function (async)
_activateExtension @ extHostExtensionService.ts:313
actualActivateExtension @ extHostExtensionService.ts:169
_activateExtension @ extHostExtensionActivator.ts:374
(anonymous) @ extHostExtensionActivator.ts:354
_activateExtensions @ extHostExtensionActivator.ts:354
activateByEvent @ extHostExtensionActivator.ts:225
_activateByEvent @ extHostExtensionService.ts:225
_handleEagerExtensions @ extHostExtensionService.ts:476
(anonymous) @ extHostExtensionService.ts:610
Promise.then (async)
_startExtensionHost @ extHostExtensionService.ts:610
initialize @ extHostExtensionService.ts:194
async function (async)
initialize @ extHostExtensionService.ts:187
v @ extensionHostMain.ts:79
(anonymous) @ extensionHostWorker.ts:143
Promise.then (async)
(anonymous) @ extensionHostWorker.ts:141
(anonymous) @ extensionHostWorker.ts:138
t._safeInvokeFunction @ loader.js:1107
t._invokeFactory @ loader.js:1126
t.complete @ loader.js:1139
s._onModuleComplete @ loader.js:1760
s._resolve @ loader.js:1720
s.defineModule @ loader.js:1367
n @ loader.js:1810
(anonymous) @ extHost.worker.services.ts:21
(anonymous) @ fake:1
e.load @ loader.js:729
e.load @ loader.js:606
o @ loader.js:1620
s._loadModule @ loader.js:1632
s._resolve @ loader.js:1716
s.defineModule @ loader.js:1367
o @ loader.js:1835
(anonymous) @ extensionHostWorkerMain.js:21
(anonymous) @ extensionHostWorkerMain.js:6

image

@code-asher
Copy link
Member

code-asher commented Dec 2, 2020 via email

@csaska
Copy link
Contributor

csaska commented Dec 2, 2020

Yes, that request succeeded. Also, this screen cap is using v3.7.4. I have the same behavior on 3.7.2 and 3.7.4.

I could try running code-server on an x86 machine and see if this same behavior exists (this is running code-server on a ppc machine and connecting via MacOs Chome browser).

image

@titouancreach
Copy link

titouancreach commented Dec 8, 2020

I'm taking place here because I've the same problem, the vim extension doesn't work neither since last versions. I host vscode server on a ubuntu x86 on a remote server and I access it via chrome on macos.
I not sur if it helps, but I can have the extension working when I reload the page with the cache disabled on the devtool:

Capture d’écran 2020-12-08 à 17 30 19

@nhooyr nhooyr added bug Something isn't working extension The issue needs to be fixed in the extension high-priority This issue needs to be resolved ASAP labels Dec 8, 2020
@dclong
Copy link

dclong commented Dec 14, 2020

I got the error "Unable to install vscodevim.vim extension because it is not compatible with the current version of VS Code (version 1.51.1)". I'm using code-serve 3.7.4.

@pojntfx
Copy link

pojntfx commented Dec 16, 2020

I can confirm @dclong's error. Pinned to 1.6.0 as a "fix" for now and disabled automatic extension updates (https://github.com/pojntfx/pojde/blob/master/setup.sh#L608). Maybe code-server should have an option to set the VSCode API version it advertises to fix this? Theia for example allows setting the API version with a CLI flag: https://github.com/pojntfx/pojde/blob/master/setup.sh#L837

@code-asher
Copy link
Member

code-asher commented Dec 16, 2020 via email

@pojntfx
Copy link

pojntfx commented Dec 19, 2020

Just re-tried this with the newest update:

code-server: v3.8.0
 VS Code: v1.51.1
Commit: c4610f7829701aadb045d450013b84491c30580d
Date: 2020-12-18T20:25:37Z
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36

Sadly, the issue still persists; 1.6.0 continues to work.

@jsjoeio jsjoeio self-assigned this Dec 21, 2020
@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 21, 2020

Taking a look at this as well. I see the same issue using and I'm using:

  • code-server: v3.8.0
  • vscodevim.vim: v1.18.5

image

However, installing v1.16.0 of the extension manually, the extension works correctly.

I'll continue to investigate.

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 21, 2020

One observation so far: it looks like part of the comptability check is looking for a webResource property here. If I comment that line out and return extension, then code-server lets me install the extension.

However, it stays grayed out and does not work.
image

I also tried manually bundling and installing v1.17.0 on code-server. That version didn't work either.

Not sure if that's any progress though. Will keep investigating.

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 22, 2020

Trying another approach: I upgraded the version of VS Code from 1.51 to 1.52 and now I get a new error:

image

Cannot install 'Vim' because this extension is not a web extension

I wonder if we need to submit a PR to the Vim extension to tell VS Code that it is a web extension. Will continue investigating.

Interestingly, there is a property in the package.json (well, Extension Manifest) called extensionKind which can be either ui or workspace. It seems the Vim extension marks itself for both here. They list web even though the docs don't say that's valid. Not sure if that could cause issues.

Update: removing web from the package.json.extensionKind in the Vim extension allowed me to install it (without the previous web warning) but, now it's grayed out and still doesn't work.

image

The other idea I have is modifying the package.json.main line. Right now, the Vim extension uses different files based on the extension and the web extension:

image

I'm curious if I use the ./out/extensionWeb file for "main" if that may work (or be related to the issue of the extension not activating).

Update: no luck, still grayed out.

The only other idea I have for debugging this is manually walk commit-by-commit starting from v1.16.0 of the Vim extension and installing in code-server until I figure out what's causing the issue. Since I know it works in v1.16.0 but not v1.17.0 I can work in between those tags, which have 98 commits in difference.

@jsjoeio
Copy link
Contributor

jsjoeio commented Dec 22, 2020

Related: VSCodeVim/Vim#5883

@jsjoeio jsjoeio assigned code-asher and unassigned jsjoeio Dec 22, 2020
@pojntfx
Copy link

pojntfx commented Jan 12, 2021

In the meantime, if one doesn't want to stick with v1.6.0, vscode-neovim works quite well now, including clipboard support in code-server (just tested it). The version in the extension marketplace seems to be out of date though, using https://open-vsx.org/extension/asvetliakov/vscode-neovim works fine.

@code-asher
Copy link
Member

Fixed in master, check the milestone for release details.

@code-asher code-asher added this to the v3.8.2 milestone Feb 9, 2021
@acondura
Copy link

Same thing, vim extension not working while using :

code-server: v3.11.0
VS Code: v1.57.1
Commit: 4e8cd09
Date: 2021-07-14T20:35:32Z
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36

@jsjoeio
Copy link
Contributor

jsjoeio commented Jul 19, 2021

@acondura please open a separate bug report!

@coder coder locked as resolved and limited conversation to collaborators Jul 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working extension The issue needs to be fixed in the extension high-priority This issue needs to be resolved ASAP
Projects
None yet
Development

No branches or pull requests

10 participants