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

bug: Jumping to a reference/definition doesn't move the window #1365

Open
3 tasks done
Tracked by #1261
Sw3d15h-F1s4 opened this issue Jul 31, 2023 · 4 comments
Open
3 tasks done
Tracked by #1261

bug: Jumping to a reference/definition doesn't move the window #1365

Sw3d15h-F1s4 opened this issue Jul 31, 2023 · 4 comments
Labels
bug Something isn't working manager: viewport

Comments

@Sw3d15h-F1s4
Copy link

Did you check docs and existing issues?

  • I have read all the vscode-neovim docs
  • I have searched the existing issues of vscode-neovim
  • I can reproduce the issue with an empty init.vim/init.lua and no other vscode extensions (when applicable)

Neovim version (nvim -v)

0.9.1

Operating system/version

Windows 11

Describe the bug

When peeking definitions (vscode: editor.action.peekDefinition) or peeking references (editor.action.referenceSearch.trigger, editor.action.goToReferences with multiple results), a dialog opens up to select where you'd like to jump to. This appears to work correctly. Selecting an entry in the list and pressing enter is supposed to then move the view/cursor to the selected location. Sometimes this works, and other times not.

To me, it looks like it works when the selected line to jump to was already visible on screen without having to scroll around. If you select a line/location that would require scrolling up, your cursor instead disappears, the page doesn't scroll, and you can't move around in the file. Scrolling down works fine if you press enter twice. Pressing seems to fix the issue, but the cursor is left back where you originally were when searching references.

Steps To Reproduce

Tested using empty init.lua and only one other plugin.

  1. Open a long file such that you have to scroll to see the top and bottom. You need a language plugin for this as well, since I don't think reference search and definitions work without one. I'm using sumneko's lua extension on a test lua file. I've got a local symbol declared at the top, and references to the symbol scattered across 80ish lines. Some near the top, middle and bottom to simulate a large code file.
  2. Cursor over an instance of the symbol. Press gd (editor.action.revealDefinition). In my test file's case, you should be at the top of the page. This is working as expected.
  3. Cursor over an instance of the symbol. Press gH (editor.action.referenceSearch.trigger). Select a reference that occurs later in the file, off the bottom of the screen using j/k, press enter. The window will jitter, your cursor disappears, and you don't scroll. Press enter again and you end up looking at your reference.
  4. Cursor over an instance of the symbol. Press gH (editor.action.referenceSearch.trigger). Select a reference that occurs earlier in the file, off the top of the screen using j/k, press enter. The window will jitter, your cursor disappears, and you don't scroll. Press enter again for the window to jitter again.
  5. Pressing escape doesn't bring you anywhere either, rather just back to where you were.

Expected Behavior

I'd expect that when selecting a reference from editor.action.referenceSearch.trigger by pressing enter, my cursor would be moved to the beginning of the reference and the view would be scrolled to see it.

Without the vscode-neovim plugin (so in my case only Lua extension) when I trigger editor.action.referenceSearch.trigger by either using Ctrl+Shift+P and typing it out or right clicking on the symbol and selecting Peek -> Peek References, I'm able to scroll around the pop up with arrow keys. Then I can press enter on a selection and my view is centered on the reference. Then I can press escape and my cursor is at the beginning of the reference.

@Sw3d15h-F1s4 Sw3d15h-F1s4 added the bug Something isn't working label Jul 31, 2023
@Jiaqigege
Copy link

neovim plugin issue
A supplemental GIF for bug reproduction is provided.
Currently on line 22, the 'gr' shortcut (customized as 'peek reference') is used to select the target on line 112, then 'enter' is pressed to jump there.
The effect is a jump to line 112 and a return to line 22. At this point, the cursor disappears, and after pressing 'esc,' it reappears at line 22.

@theol0403
Copy link
Member

Duplicate of #1027

@yoychen
Copy link

yoychen commented Sep 14, 2023

@theol0403
I think the issue is not the same as #1027 because #1027 is occurring in version 0.0.91, but I has the issue in the current version 0.5.0
I switch to the older version of vscode-neovim and found that it does not has this issue in 0.3.2. I suspect this issue is introduced after 0.3.2.

@Gxinhu
Copy link

Gxinhu commented Sep 18, 2023

I have met the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working manager: viewport
Projects
None yet
Development

No branches or pull requests

5 participants