nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.9k stars 835 forks source link

Builtin LSP goto definition won't work in clojure_lsp #1068

Closed glyh closed 3 years ago

glyh commented 3 years ago

Description

I'm trying to use the commmand ":Telescope lsp_definitions", only to find it won't work.

Expected Behavior

Cursor jump to the definition of current symbol.

Actual Behavior

Nothing happens.

Details

Reproduce 1. ```shell mkdir foo cd foo git init # This is for helping lspconfig to recognize the project root. touch test.clj ``` 2. write the following to test.clj ```clj (defn x [] 1) (defn y [] (x)) ``` 3. `nvim -u init.lua`, where init.lua is: ```lua require('packer').startup( {function() -- Packer can manage itself use 'wbthomason/packer.nvim' use 'neovim/nvim-lspconfig' use { 'nvim-telescope/telescope.nvim', requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}}, commit = "b742c50bf119d7c442a553cc52e8afde0086ae02" } end, config={git={default_url_format="https://hub.fastgit.org/%s"}}}) require('lspconfig').clojure_lsp.setup({}) ``` 4. type `:PackerSync`, after updating, restart with `nvim -u init.lua test.clj` 5. put cursor on x, type `:lua vim.lsp.buf.definition()`, it successfully jumped to definition of x. 6. put cursor on x, type `:Telescope lsp_definitions`, nothing happens.
Environment - nvim --version output: ``` NVIM v0.5.0 Build type: Release LuaJIT 2.1.0-beta3 Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -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=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim/src/neovim-0.5.0/build/config -I/build/neovim/src/neovim-0.5.0/src -I/usr/include -I/build/neovim/src/neovim-0.5.0/build/src/nvim/auto -I/build/neovim/src/neovim-0.5.0/build/include Compiled by builduser Features: +acl +iconv +tui See ":help feature-compile" system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim" Run :checkhealth for more info ``` - Operating system: ``` Linux arch 5.13.6-arch1-1 #1 SMP PREEMPT Thu, 29 Jul 2021 00:21:06 +0000 x86_64 GNU/Linux ``` - Telescope commit: `b742c50bf119d7c442a553cc52e8afde0086ae02`
Configuration(lua)

```lua require('packer').startup( {function() -- Packer can manage itself use 'wbthomason/packer.nvim' use 'neovim/nvim-lspconfig' use { 'nvim-telescope/telescope.nvim', requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}}, commit = "b742c50bf119d7c442a553cc52e8afde0086ae02" } end, config={git={default_url_format="https://hub.fastgit.org/%s"}}}) require('lspconfig').clojure_lsp.setup({}) ``` (Same as above)

Other Information I've also tried clangd, and it works fine with both `:lua vim.lsp.buf.definition()` and `:Telescope lsp_definitions`, so I'm not sure what is happening. But most possibly it's the problem of telescope.nvim's builtin goto definition.
elianiva commented 3 years ago

just to make sure, doing vim.lsp.buf.definition() without Telescope using clojure lsp works fine, correct? If it doesn't then it's the server's fault.

Linouth commented 3 years ago

I had the same issue with zls. Pull request #1101 is a simple fix for this bug.

As described in the PR it was the list_or_jump function not handling the result correctly for servers responding with a single result without surrounding list.

Conni2461 commented 3 years ago

I hope this is fixed in https://github.com/nvim-telescope/telescope.nvim/commit/06e55d3b3afe4b3070783699ecc8985f0236caa4. I have no way to test this :grimacing:

Closing for now. If there are still issues. Feel free to reopen