VSCodeVim / VSCodeVim/Vim

For some symbols, `gd` jumps to a wrong location several seconds after jumping to the correct definition.

Open
#3,797 4 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug
For some symbols, 'gd' jumps to the end of the file containing the real definition. Following c-o will jump back to the beginning of the file.

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to a symbol (I'm browsing C++ code) and press 'gd' to jump to the definition.
  2. Cursor will jump to the definition correctly.
  3. Wait for about 3 seconds without any further inputs, the cursor will then jump to the end of the file.
  4. Press c-o will jump to the beginning of the file.
  5. Press c-o again will jump back to the end of the file.
  6. Press c-o the third time will jump back to where 'gd' is issued.

Expected behavior
F12 and Alt+Left Arrow works correctly. 'gd' and c-o should jump to the correct locations.

Screenshots
If applicable, add screenshots to help explain your problem.
If remapping-related, please attach log output: https://github.com/VSCodeVim/Vim#debugging-remappings.

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.8.1
  • VSCode version: 1.35.0 - insider / 1.34.0
  • OS: Win10 64

Additional context
Add any other context about the problem here.

Here is the log in the developers console when I hit the bug:
[Extension Host] ModeHandler: debug: handling key=g.
workbench.main.js:238 [Extension Host] Remapper: debug: trying to find matching remap. keys=g. mode=Normal. keybindings=normalModeKeyBindingsMap.
workbench.main.js:238 [Extension Host] Remapper: debug: trying to find matching remap. keys=g. mode=Normal. keybindings=normalModeKeyBindingsNonRecursiveMap.
workbench.main.js:238 [Extension Host] ModeHandler: debug: handling key=d.
workbench.main.js:238 [Extension Host] Remapper: debug: trying to find matching remap. keys=d. mode=Normal. keybindings=normalModeKeyBindingsMap.
workbench.main.js:238 [Extension Host] Remapper: debug: trying to find matching remap. keys=d. mode=Normal. keybindings=normalModeKeyBindingsNonRecursiveMap.
workbench.main.js:238 [Extension Host] VimState: warn: invalid cursor position. [ [2555, 56] | [2555, 56]].
workbench.main.js:238 [Extension Host] VimState: warn: invalid cursor start position. [2555, 56].
workbench.main.js:238 [Extension Host] ModeHandler: debug: handling key=.
workbench.main.js:238 [Extension Host] Remapper: debug: trying to find matching remap. keys=. mode=Normal. keybindings=normalModeKeyBindingsMap.
workbench.main.js:238 [Extension Host] Remapper: debug: trying to find matching remap. keys=. mode=Normal. keybindings=normalModeKeyBindingsNonRecursiveMap.
workbench.main.js:238 [Extension Host] ModeHandler: debug: handling key=.
workbench.main.js:238 [Extension Host] Remapper: debug: trying to find matching remap. keys=. mode=Normal. keybindings=normalModeKeyBindingsMap.
workbench.main.js:238 [Extension Host] Remapper: debug: trying to find matching remap. keys=. mode=Normal. keybindings=normalModeKeyBindingsNonRecursiveMap.
workbench.main.js:238 [Extension Host] VimState: warn: invalid cursor stop position. [2555, 56].
workbench.main.js:238 [Extension Host] VimState: warn: invalid cursor start position. [2555, 56].
workbench.main.js:238 [Extension Host] ModeHandler: debug: handling key=.
workbench.main.js:238 [Extension Host] Remapper: debug: trying to find matching remap. keys=. mode=Normal. keybindings=normalModeKeyBindingsMap.
workbench.main.js:238 [Extension Host] Remapper: debug: trying to find matching remap. keys=. mode=Normal. keybindings=normalModeKeyBindingsNonRecursiveMap.
workbench.main.js:238 [Extension Host] getCursorsAfterSync: warn: getCursorsAfterSync: selection not updated within 0ms.

[2555,56] is acutally the line and column where I pressed 'gd'. The first warning is triggered about 3 seconds after the cursor jumps to the correct location.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the delayed jump using gd on a C++ symbol, then inspect the gd and c-o handling associated with the logged invalid cursor positions. Done means the cursor remains at the correct definition after the delay and c-o returns through the expected locations without invalid-position warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.