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

this plugin breaks :w in vim plugin #10

Closed
ryanrca opened this issue Apr 16, 2019 · 7 comments · Fixed by #20
Closed

this plugin breaks :w in vim plugin #10

ryanrca opened this issue Apr 16, 2019 · 7 comments · Fixed by #20
Labels
extension compatibility Compatibility with another extension is broken.

Comments

@ryanrca
Copy link

ryanrca commented Apr 16, 2019

I've narrowed it down to this plugin.

When using this plugin with the vim plugin, it breaks the very important :w operator to save your file. When disabling vsc-python-indent, :w works well. When enabling it, :w fails when editing any .py file. This is the stack trace in dev tools:

mainThreadExtensionService.ts:60 [[object Object]]Illegal value for `line`
$onExtensionRuntimeError @ mainThreadExtensionService.ts:60
_doInvokeHandler @ rpcProtocol.ts:399
_invokeHandler @ rpcProtocol.ts:384
_receiveRequest @ rpcProtocol.ts:304
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:584
a @ ipc.net.ts:392
e @ ipc.net.ts:399
fire @ event.ts:584
_receiveMessage @ ipc.net.ts:678
_socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:549
fire @ event.ts:584
acceptChunk @ ipc.net.ts:212
_register._socket.onData.e @ ipc.net.ts:173
t @ ipc.net.ts:24
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
mainThreadExtensionService.ts:61 Error: Illegal value for `line`
	at u._lineAt (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:356)
	at Object.lineAt (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:355)
	at TagManager.getWordAtPosition (/home/ryan/.vscode/extensions/formulahendry.auto-rename-tag-0.0.15/out/src/tagManager.js:36)
	at TagManager.getCurrentWord (/home/ryan/.vscode/extensions/formulahendry.auto-rename-tag-0.0.15/out/src/tagManager.js:29)
	at run.vscode.window.onDidChangeTextEditorSelection.event (/home/ryan/.vscode/extensions/formulahendry.auto-rename-tag-0.0.15/out/src/tagManager.js:11)
	at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:44)
	at c.$acceptEditorPropertiesChanged (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:577)
	at d._doInvokeHandler (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:622)
	at d._invokeHandler (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:621)
	at d._receiveRequest (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:620)
	at d._receiveOneMessage (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:619)
	at define.constructor._protocol.onMessage.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:617)
	at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:44)
	at e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:40)
	at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:44)
	at a (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:172)
	at e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:172)
	at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:44)
	at y._receiveMessage (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:181)
	at define.constructor._socketDisposables.push._socketReader.onMessage.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:178)
	at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:44)
	at f.acceptChunk (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:175)
	at define.constructor._register._socket.onData.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:174)
	at Socket.t (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:182)
	at Socket.emit (events.js:182)
	at addChunk (_stream_readable.js:279)
	at readableAddChunk (_stream_readable.js:264)
	at Socket.Readable.push (_stream_readable.js:219)
	at Pipe.onread (net.js:636)```
@kbrose
Copy link
Owner

kbrose commented Apr 24, 2019

Thanks for leaving an issue! Could you specify which vim plugin you are talking about?

@above-c-level
Copy link

Hey, I just stopped by to leave the same issue. It's possible he's talking about another vim plugin, but it definitely breaks VSCodeVim.

@ryanrca
Copy link
Author

ryanrca commented Apr 30, 2019

Thanks for leaving an issue! Could you specify which vim plugin you are talking about?

VS code python indent

@kbrose kbrose added extension compatibility Compatibility with another extension is broken. help wanted labels May 2, 2019
@kbrose
Copy link
Owner

kbrose commented May 2, 2019

VS code python indent

I believe that's my extension :)

@above-c-level or @ryanrca, could one of you give me a step-by-step instructions for reproducing? I've not used the vim plugin before.

@above-c-level
Copy link

Yeah no problem! Basically when using vim, you can normally do :w or :wa (colon puts vim into command mode, w means write, a means all), hit enter, and your file(s) is/are saved. For some reason though, vim no longer seems to accept hitting enter in command mode while this plugin is activated, which is necessary for normal operation. Hope this helps

@ryanrca
Copy link
Author

ryanrca commented May 3, 2019

Try this. Start with a fresh install of VSCode.

  • Install vim plugin
  • Install python plugin
  • Open a python file
  • Edit it: (click i for insert mode, type # test 1234. click esc a couple times to exit insert mode)
  • open dev tools ( Help | Toggle Developer Tools). Go to "console' and clear the console.
  • Save the python file (:w<enter>)

See nothing in the dev tools error console. Observe the file is saved to disk.

  • Install Python indent plugin.
  • Make another edit to a python file
  • Try to save the file (:w<enter>)

See the stack trace in the dev tools error Console. Observe the file is NOT saved to disk.

  • Disable Python Indent plugin.
  • Make another edit to a python file
  • Save the file (:w<enter>)

See nothing in the dev tools error console. Observe the file is saved to disk.

@kbrose
Copy link
Owner

kbrose commented May 4, 2019

EDIT: This should be resolved in versions v0.7.0 and above, please try upgrading. If the issue persists, please open a new issue.

Thanks for the descriptions!

The problem is that this extension sets the Enter key as a keyboard shortcut, and when the Vim plugin is not in Insert mode, overriding the Enter key means you can't send commands.

In VSCode, you can refine the conditions of when a shortcut will fire, and I can do that for when vim.mode == 'Insert', but this breaks the keyboard when the user does not have the Vim extension installed. As far as I can tell, the when syntax of keyboard shortcuts does not support checking for the existence of a vim.mode variable first.

I'm going to file an issue with the Vim extension to see if we can get a good solution in place.

As a workaround in the meantime, you can edit your own conditions:

  1. Have both the Vim extension and the python indent extensions installed
  2. Open up the keyboard shortcuts page (Ctrl-k Ctrl-s on linux/windows, ⌘-k ⌘-s on Mac)
  3. Use the top bar to search for "pythonindent" (no space)
  4. Right click the pythonIndent.newlineAndIndent row (should be the only row)
  5. Select "Change When Expression"
  6. Add && vim.mode == 'Insert' to the end of the expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension compatibility Compatibility with another extension is broken.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants