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

Cursor jumps up to the beginning of a file after saving. #3444

Closed
agubarev opened this issue Feb 2, 2019 · 18 comments
Closed

Cursor jumps up to the beginning of a file after saving. #3444

agubarev opened this issue Feb 2, 2019 · 18 comments
Labels

Comments

@agubarev
Copy link

agubarev commented Feb 2, 2019

Good day everyone,

FOREWORD: This is happening only when working with Go files and only when VIM plugin is installed.

Cursor jumps to the "import" line if I move the cursor after saving and if I move again it goes down a few lines; I'm not even sure it tries to return to its previous place, just jumps like a half screen down. This happens only when the OUTPUT tab is open (on the right side) with "Go Tests" printing its usual output. I guess it's interfering with the editor window somehow. First thing that comes to my mind is that the cursor position is reset on keypress after saving.

I've noticed this only yesterday as I've moved back to Linux(Ubuntu 18.10) from MacOS and I've copied only few of my snippets and user settings. Btw, I've worked on this Linux machine for quite a while before spending some time on MacOS, and everything worked perfectly.

I've tested by disabling, reinstalling, deleting all configuration. (including ~/.config/CODE), and also changed to all available go formatters but the problem still persists unfortunately.

@stephen-soltesz
Copy link

stephen-soltesz commented Feb 3, 2019

I am experiencing the same issue: VScode+Go+Vim plugins cause the cursor to relocate on save. I can confirm that the behavior change occurred between vim plugin versions 1.0.2 (expected behavior after save) and 1.0.3+ (cursor relocating). For now I've downgraded my version of the vim plugin as a workaround. (From the vscode extensions list, click on the Vim settings "gear" icon, and select "Install Another Version...")

EDIT: using Go plugin version 0.8, vscode version 1.30.2 on Mac OS X.
AFAICT, the Go plugin 0.8 was released Dec 12, 2018, and the 1.30.2 release of VScode was released around early Jan 2019. And, the behavior change on save occurred more recently, within the last few weeks. There have been numerous updates to the vim plugin in that time.

@agubarev
Copy link
Author

agubarev commented Feb 3, 2019

I've followed your example and downgraded gradually down to 1.0.2 (apparently things got broken above this version). Everything works fine atm, waiting for an update.

P.S. you guys are doing an amazing job and how you've managed to embed VIM so gently, and how it interoperates with VSCODE... thanks!

AND huge thanks to the GO extension team for creating such a superb Golang support in VSCODE (since I know you're following this too ^^) One big THANKS to both teams :)

@noseglid
Copy link

noseglid commented Feb 4, 2019

I have this exact same issue.

Thanks to @agubarev I downgraded to 1.0.2 (cmd-alt-p -> Extensions: Install Specific Version of Extension -> Vim -> 1.0.2)
Also add

"extensions.autoUpdate": false,

Or you'll get the latest version.

@agubarev
Copy link
Author

agubarev commented Feb 4, 2019

Thanks to @agubarev I downgraded to 1.0.2

Nah, thanks to @stephen-soltesz

@jpoon
Copy link
Member

jpoon commented Feb 4, 2019

Can't repro... either with :w or a ctrl+s. The cursor stays where it should be.

Nothing is apparent looking at the diff between the two versions. v1.0.2...v1.0.3

@stephen-soltesz
Copy link

@jpoon can you confirm, what plugins are enabled during your test? There may be a subtle interaction between the Go & Vim plugins. I'm sure I or @agubarev or @noseglid could provide additional diagnostic information if we knew what would be helpful to provide. Does the vim plugin have a "debug" logging option, for example?

@jpoon
Copy link
Member

jpoon commented Feb 4, 2019

Does the vim plugin have a "debug" logging option, for example?

See the *.debug options. https://github.com/VSCodeVim/Vim#vscodevim-settings

@noseglid
Copy link

noseglid commented Feb 5, 2019

I've enabled the debug option, and all output I get is;

[Extension Host] ModeHandler: debug: handling key=j.
console.ts:134 [Extension Host] Remapper: debug: trying to find matching remap. keys=j. mode=Normal. keybindings=normalModeKeyBindingsMap.
console.ts:134 [Extension Host] Remapper: debug: trying to find matching remap. keys=j. mode=Normal. keybindings=normalModeKeyBindingsNonRecursiveMap.
2console.ts:134 [Extension Host] Remapper: verbose: key=j. keySlice=j.

Here's a gif outlining how it goes. After the test has been run I need to move the cursor before the jump actually happens. So I press j or k and then it jump to "near the top". It seems a bit random where it actually ends up.
jumpy

@noseglid
Copy link

noseglid commented Feb 7, 2019

Awesome! This is resolved for me by 1.0.8 - Thanks for the very quick response!

@nosarthur
Copy link

I still have this problem with vim plugin 1.10.0, go plugin 0.11.4, and vs 1.37.1

@superdit
Copy link

same problem happen to me on, vs 1.37.1, extensions: go plugin 0.11.4, live server 5.6.1, material icon theme 3.9.0

@freerider7777
Copy link

same problem VS 1.38.1 go plugin 0.11.6

@srinathh
Copy link

srinathh commented Sep 29, 2019

I'm having the same problem still VSCodeVIM version - 1.11.0, Go version 0.11.7. Happens on Windows, doesn't happen on Linux.

@freerider7777
Copy link

Yes, very annoying... Workaround is mouse click in the place of cursor after save....

@vamseekm
Copy link

Still happening with ctrl+s shortcut. But not with :w in vim mode.

@von-court
Copy link

Still happening with CTRL+S on Windows 10, VS Code 1.44.2, go 1.14.2 & VSCodeVim 1.13.1

@Gawainli
Copy link

Gawainli commented Apr 30, 2020

same problem on windows
vscode-1.44.2, vim extension-1.13.1, go extension-0.14.1
Thanks @stephen-soltesz. Downgrade vim to 1.0.2 works for me.

@navarrothiago
Copy link

Just to give an updated, I have the same problem on Linux, Vscode v1.75, VSCodeVim v1.25.2, Go v0.38.0.

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

No branches or pull requests