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

Incompatibility with Vim plugin on latest version #410

Closed
TomFors opened this issue Jan 17, 2020 · 17 comments
Closed

Incompatibility with Vim plugin on latest version #410

TomFors opened this issue Jan 17, 2020 · 17 comments

Comments

@TomFors
Copy link

TomFors commented Jan 17, 2020

When upgrading the Haxe VSCode extension v2.17.0 I noticed that I was unable to navigate using vim movement commands using the Vim extension v1.12.4. Instead of moving, all keystrokes were inserted at the current position as if the Vim extension was not getting the inputs. Hitting escape did not fix the issue. The VIM mode selection was still running and was showing -- NORMAL --. Downgrading the Haxe extension to v2.16.5 fixes the problem for me.

I am running VSCode 1.41.1 on Windows 10 64-bit.

Here's the user settings.json I'm using:

{
    "breadcrumbs.enabled": true,
    "haxe.enableCodeLens": false,
    "vim.ignorecase": true,
    "vim.smartcase": true,
    "window.zoomLevel": 0,
    "workbench.iconTheme": "material-icon-theme",
    "files.exclude": {
        "**/*.hxproj": true
    },
    "vim.handleKeys": {
        "<C-a>": false,
        "<C-c>": false,
        "<C-n>": false,
        "<C-w>": false,
        "<C-v>": false,
        "<C-o>": false,
        "<C-k>": false,
        "<C-y>": false,
        "<C-x>": false,
        "<C-t>": false
    },
    "haxe.buildCompletionCache": true,
    "editor.insertSpaces": false,
    "editor.trimAutoWhitespace": false,
    "haxe.enableExtendedIndentation": true
}
@Gama11
Copy link
Member

Gama11 commented Jan 17, 2020

"haxe.enableExtendedIndentation": true

There's your issue. To implement this feature, we have to override the same "type" command that the Vim extension uses under the hood. As far as I know there's no way to avoid this conflict... microsoft/vscode#13441

Note that "haxe.enableExtendedIndentation" is opt-in for this and other reasons (potential performance overhead as documented in the wiki).

@Gama11
Copy link
Member

Gama11 commented Jan 17, 2020

I've added a note about the incompatibility with the Vim extension to https://github.com/vshaxe/vshaxe/wiki/Auto-Indentation.

@TomFors
Copy link
Author

TomFors commented Jan 17, 2020

Thank you! That second option solved the problems I was having!

@moltzaum
Copy link

moltzaum commented Jun 9, 2020

@Gama11 I am running into a similar incompatibility with vim as described in this issue, but I did not set "haxe.enableExtendedIndentation" to true. Downgrading worked for me and I think I'll use the older version for now. If you have any additional insights I'd appreciate it.

@Gama11
Copy link
Member

Gama11 commented Jun 9, 2020

Are you sure about that? Flixel generates a settings.json where it's true by default for instance.

@tmunro
Copy link

tmunro commented Jun 10, 2020

I have this same issue with the latest version, and it turns out I had a workspace setting overriding the indentation setting to true. However, the feedback that the extension failed to load (and why) was pretty tricky to track down - is there any way that could be improved to more specifically point to this?

@Gama11
Copy link
Member

Gama11 commented Jun 10, 2020

What do you mean by "extension failed to load"?

@tmunro
Copy link

tmunro commented Jun 10, 2020

This error from exthost.log:

[2020-06-10 10:20:04.736] [exthost] [error] Activating extension nadako.vshaxe failed due to an error:
[2020-06-10 10:20:04.738] [exthost] [error] Error: command 'type' already exists
	at e.registerCommand (c:\Users\tmunro\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:626:665)
	at Object.registerCommand (c:\Users\tmunro\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:897:64)
	at vshaxe_AutoIndentation.updateExtendedIndentation (c:\Users\tmunro\.vscode\extensions\nadako.vshaxe-2.20.2\bin\index.js:1:166413)
	at new vshaxe_AutoIndentation (c:\Users\tmunro\.vscode\extensions\nadako.vshaxe-2.20.2\bin\index.js:1:165236)
	at new vshaxe_Main (c:\Users\tmunro\.vscode\extensions\nadako.vshaxe-2.20.2\bin\index.js:1:172965)
	at main (c:\Users\tmunro\.vscode\extensions\nadako.vshaxe-2.20.2\bin\index.js:1:175098)
	at Function._callActivateOptional (c:\Users\tmunro\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:824:355)
	at Function._callActivate (c:\Users\tmunro\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:824:6)
	at c:\Users\tmunro\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:822:960
	at processTicksAndRejections (internal/process/task_queues.js:85:5)
	at async Promise.all (index 0)
	at async Promise.all (index 1)
	at async Promise.all (index 81)

@Gama11
Copy link
Member

Gama11 commented Jun 10, 2020

Huh, I didn't realize this triggers an exception that causes the whole activation to fail, that's pretty bad. I think the behavior here may have changed in recent VSCode versions, not sure.

I'll have to see if it's possible to try-catch or otherwise detect that...

Edit: Hm, it might simply always have been like that, there's reports of that error in other extensions from 2019: msafi/xvsc#11 (comment)

@Gama11
Copy link
Member

Gama11 commented Jun 10, 2020

Ah, I guess this depends on extension loading order. When I previously tested this, it was always the Haxe extension that was loaded first, causing the Vim extension to be the one that fails to load. Anyway, looks like a regular try-catch works fine.

@tmunro
Copy link

tmunro commented Jun 10, 2020

Great, thanks for the quick response!

@Gama11
Copy link
Member

Gama11 commented Jun 10, 2020

Just published 2.20.3, which displays the following in case of failure (and avoids Haxe failing to activate entirely):

image

@tmunro
Copy link

tmunro commented Jun 11, 2020 via email

@moltzaum
Copy link

@Gama11

Are you sure about that? Flixel generates a settings.json where it's true by default for instance.

I'm not sure where that file would be. The only settings files are below, the bottom one never was set to "true", and I've set it to false explicitly as well.

/usr/local/lib/haxe/lib/flixel-tools/1,4,4/settings.json

{"AuthorName":"","IDEA_Path":"/Applications/Cardea-IU-130.1619.app/Contents/MacOS/idea","DefaultEditor":"Visual Studio Code","IDEA_Flixel_Engine_Library":"Flixel Engine","IDEA_Flixel_Addons_Library":"Flixel Addons","IDEAutoOpen":true,"IDEA_flexSdkName":"flex_4.6"}

~/Library/Application Support/Code/User/settings.json

{
    "haxe.codeGeneration": {},
    "extensions.autoUpdate": false,
    "editor.trimAutoWhitespace": false,
    "haxe.enableExtendedIndentation": false,
}

@moltzaum
Copy link

@tmunro

What was the workspace setting?

@Gama11
Copy link
Member

Gama11 commented Jun 11, 2020

@moltzaum .vscode/settings.json in your workspace / project?

@moltzaum
Copy link

@Gama11 Yep, it was there. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants