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

Previous location is not appended to the jump list when using lsp_references. #1038

Closed
kcivkulis opened this issue Jul 21, 2021 · 4 comments · Fixed by #1234
Closed

Previous location is not appended to the jump list when using lsp_references. #1038

kcivkulis opened this issue Jul 21, 2021 · 4 comments · Fixed by #1234
Labels
bug Something isn't working

Comments

@kcivkulis
Copy link

Description

When jumping to a reference in the same file using :Telescope lsp_references the previous location is not appended to jump list, therefore ctrl-o doesn't work as expected.

Expected Behavior

Previous location is appended to jump list.

Actual Behavior

Jump list is not changed.

Details

Reproduce
  1. Move to some symbol
  2. :clearjumps
  3. :Telescope lsp_references
  4. Select any reference in the same file
  5. Observe that jump list is still empty
Environment
  • nvim --version output:
NVIM v0.6.0-dev+48-g5377b2b00
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto
-DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/kristaps/neovim/build/config -I/home/kristaps/neovim/src -I/home/kristaps/neovim/.deps/usr/include -I/usr/include -I/home/kristaps/neovim/build/src/nvim/auto -I/home/kristaps/neovim/build/include
Compiled by kristaps

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info
  • Operating system:
    Arch linux
  • Telescope commit:
    6646900
@kcivkulis kcivkulis added the bug Something isn't working label Jul 21, 2021
@kcivkulis
Copy link
Author

This could be fixed by adding vim.cmd "normal! m'" to action_set.edit function, although this is definitely a hack.

Also (this is only slightly related), there is no issue when using :Telescope live_grep and jumping to the same file because in that case filename contains a redundant /./ and doesn't exactly match the return value of vim.api.nvim_buf_get_name(0) , therefore the if condition is true.

@fdschmidt93
Copy link
Member

I'm happy to help guide you towards a PR to fix the issue. Otherwise, an issue at this is quite niche and difficult to fix for just anyone.

cc @caojoshua as the original creator of the jumplist picker (maybe you are willing to help)

@caojoshua
Copy link
Contributor

The change is simple enough so I just went ahead and created a PR. Please review if you have the time.

This could be fixed by adding vim.cmd "normal! m'" to action_set.edit function, although this is definitely a hack.

I don't consider this a hack. Builtin LSP does this. See the PR description for more details.

@Massolari
Copy link

This is also needed for document_symbols()

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

Successfully merging a pull request may close this issue.

4 participants