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

feat(lsp-jump-type): tab drop as new jump_type option for go-to LSP pickers #2751

Merged
merged 4 commits into from
Oct 23, 2023

Conversation

HicaroD
Copy link
Contributor

@HicaroD HicaroD commented Oct 22, 2023

Description

Sometimes when I'm coding I want to jump to a definition using the command builtin.lsp_definitions, for example, and it adds a new buffer on top of the buffer I'm working on. This behavior is something I don't like, so I started reading the documentation for changing that behavior and I found a parameter called jump_type and I set it to tab. However, there is another problem: when I jump to a definition, it adds a new tab buffer, but, if that tab buffer is already opened, it does not jump to it, it adds a new one. So, the behavior that I was looking for only exists with the command tab drop, so I added it to the list of options for the jump_type parameter of the following commands: builtin.lsp_type_definitions, builtin.lsp_implementations, builtin.lsp_references and builtin.lsp_definitions.

NOTE: I'm using native Neovim tabs, not the plugin bufferline.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • Using nvim-lspconfig for providing LSP features, tab drop as jump_type option in the following Telescope LSP pickers: builtin.lsp_type_definitions, builtin.lsp_implementations, builtin.lsp_references and builtin.lsp_definitions, and pyright as my Python language server, I have some files that import things from each other, and I tried to use builtin.lsp_definitions feature for going to the definition of some random class defined in other file, and it opened a new tab buffer (like expected). After this, I left the definition tab buffer opened and used the same command for going to the definition, and it jumped to the existing buffer instead of adding a new one. Additionally, I tried some equivalent example in some Golang code using gopls as my language server and it worked perfectly as well. It worked well for the remaining LSP pickers.

Configuration:

  • Neovim version (nvim --version):

    NVIM v0.9.2
    Build type: Release
    LuaJIT 2.1.1694285958
    
  • Operating system and version:

    OS: Manjaro Linux x86_64
    Kernel: 6.1.55-1-MANJARO
    

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

Now, you're able to use `tab drop` as `jump_type` for these LSP
features: references, type definitions, definitions an implementations.
@HicaroD HicaroD changed the title feat(lsp-jump-type): tab drop as new jump_type for LSP pickers feat(lsp-jump-type): tab drop as new jump_type option for go-tos LSP pickers Oct 22, 2023
@HicaroD HicaroD changed the title feat(lsp-jump-type): tab drop as new jump_type option for go-tos LSP pickers feat(lsp-jump-type): tab drop as new jump_type option for go-to LSP pickers Oct 22, 2023
@Conni2461
Copy link
Member

LGTM thanks :)

i've ran docgen so the vim documentation is generated.

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

Successfully merging this pull request may close these issues.

2 participants