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

<c-o> jumps back to wrong location after 'gd' #3277

Closed
js-shi opened this issue Dec 19, 2018 · 17 comments
Closed

<c-o> jumps back to wrong location after 'gd' #3277

js-shi opened this issue Dec 19, 2018 · 17 comments

Comments

@js-shi
Copy link

js-shi commented Dec 19, 2018

Describe the bug
When navigating some C++ source code, I found C-o sometimes cannot jump back to the correct position before 'gd'. On the other hand, Alt + Left Arrow can correctly jump back to the call site.

To Reproduce
Steps to reproduce the behavior:

Just use 'gd' to perform go to symbol on the call site and to jump back. In most cases, it works great but sometimes not. The bug can be reproduced constantly but I cannot figure out the pattern yet.

Expected behavior
Jump back to the correct position.

  • Extension (VsCodeVim) version: 0.17.0
  • VSCode version: 1.30.0
@GrandZhuo
Copy link

I have encountered the same problem recently, but I don't remember which version started to have the problem.
And I found that if I use "gd" jump to the definition in the same file, I can't jump back to the correct position using . But it works if I jump to the definition in different files.
I hope to fix this bug as soon as possible.

@wYuanHpp
Copy link

same issues

@jpoon
Copy link
Member

jpoon commented Dec 29, 2018

Thanks @GrandZhuo for describing the behaviour. Really helped track down the issue.

Filed microsoft/vscode#65809 against VS Code. The API call to go to the definition returns immediately. As a result, when we save the jump location, we are saving the old location before the cursor actually moves to the new location.

Adding a 1s sleep seems to do the trick.

@jpoon
Copy link
Member

jpoon commented Jan 17, 2019

We can get rid of our hack following https://github.com/Microsoft/vscode/milestone/83.

@eddiewang
Copy link

I'm currently on v1.31.0 and experiencing the same issue. Just to confirm, when I use gd to jump to a different file, I am unable to use c-o to go back to that file.

Using c-p-p is my current workaround for this.

@solomonchild
Copy link

solomonchild commented Feb 12, 2019

The same behavior is observed if you Ctrl+Click instead of gd. C-o jumps to a wrong location (even if it is the same file).

Version: 1.31.0

@emmanueltouzery
Copy link

I think this issue is still present, the bug probably should be reopened. I'm certainly having issues with C-o myself, the builtin VS code shortcut works fine though.

emmanueltouzery added a commit to emmanueltouzery/dotfiles that referenced this issue Mar 19, 2019
yaegaki added a commit to yaegaki/Vim that referenced this issue Jul 8, 2019
jpoon pushed a commit that referenced this issue Jul 8, 2019
* Assign activeTextEditor to local variable first.

because activeTexteditor may have changed after call async method.
fixes #3865

* Get rid of workaround to wait goToDeclaration

related #3277
@ihaveadrame
Copy link

Now I have a similar problem,go to defined works fine but error when jumping back(ctrl + o). I found that this problem is normal in the old version, such as 1.11.3 I use now。

os: win10

@troygibb
Copy link

troygibb commented Jan 23, 2020

Per earlier comments about the built-in VSCode shortcut working just fine-- just remap your shortcuts to use the native VSCode go back/go forward functions instead VSCodeVim. I.e. in your settings:

"vim.handleKeys": {
    "<C-o>": false
}

And then in Keyboard Shortcuts change the settings for Go Back and Go Forward to Ctrl + o and Ctrl + i respectively. (For some reason disabling vscode <C-o> screwed up the Go Forward command.)

@drewthor
Copy link

drewthor commented Jan 23, 2020

A workaround but it's a stopgap solution because it adds more annoyances. It does not perform like vim's go back and forward commands. Instead it goes back and forward on every up and down arrow key movement as well which is a huge annoyance consistently

@jmaha
Copy link

jmaha commented Feb 12, 2020

Agreed that this should be reopened. This behavior is maddening.

@jpoon jpoon reopened this Feb 13, 2020
@kortina
Copy link

kortina commented Feb 18, 2020

I have confirmed the same issue,

  • Mac Catalina 10.15.3 (19D76)
  • VS Code Version: 1.42.1
  • vscode vim 1.12.4

I considered @troygibb's solution, but while 'Go Back' does return you correctly after 'Go To Definition,' you lose a bunch of the other cases that vscode vim jumplist handles better.

Any ideas on root cause or ETA for fix?

@jiapengwen
Copy link

I have confirmed the same issue,

  • Mac Catalina 10.15.3 (19D76)
  • VS Code Version: 1.42.1
  • vscode vim 1.12.4

I considered @troygibb's solution, but while 'Go Back' does return you correctly after 'Go To Definition,' you lose a bunch of the other cases that vscode vim jumplist handles better.

Any ideas on root cause or ETA for fix?

+1, the same issue

@kortina
Copy link

kortina commented Feb 25, 2020

I noticed there has not been a release to the extension since 26 Dec 2019. Does anyone know how often releases go out / when the commit that closes this would be part of the public extension?

@J-Fields
Copy link
Member

@kortina There isn't a set release cycle. There are a few more PRs I want to merge before the next release, but it should be soon.

@ocodista
Copy link

ocodista commented Nov 1, 2021

Same here

@YHM404
Copy link

YHM404 commented Jul 24, 2023

Per earlier comments about the built-in VSCode shortcut working just fine-- just remap your shortcuts to use the native VSCode go back/go forward functions instead VSCodeVim. I.e. in your settings:

"vim.handleKeys": {
    "<C-o>": false
}

And then in Keyboard Shortcuts change the settings for Go Back and Go Forward to Ctrl + o and Ctrl + i respectively. (For some reason disabling vscode <C-o> screwed up the Go Forward command.)

this works for me, thx.

kortina added a commit to kortina/dotfiles that referenced this issue Jul 24, 2023
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