nvim-telescope / telescope.nvim

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

Telescope document symbols of not currently open buffers #2742

Open meetmangukiya opened 10 months ago

meetmangukiya commented 10 months ago

Description

require("telescope.builtin").lsp_document_symbols({ bufnr = OTHER_BUFFER_NUMBER })

shows buffer symbol of the current buffer in the picker, but in the previewer shows the OTHER_BUFFER. It should show the symbols of the OTHER_BUFFER

Neovim version

NVIM v0.10.0-dev-a63c670
Build type: Release
LuaJIT 2.1.1693350652

Operating system and version

macOS 14.0

Telescope version / branch / rev

telescope 0.1.3

checkhealth telescope

telescope: health#telescope#check

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fd 8.7.0

===== Installed extensions ===== ~

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Steps to reproduce

just run with a non current buffer number

:lua require("telescope.builtin").lsp_document_symbols({ bufnr = OTHER_BUFFER_NUMBER })

Expected behavior

picker should be showing OTHER_BUFFER_NUMBER's symbols, previewer is showing correct buffer

Actual behavior

picker is showing current buffer symbols

Minimal config

I am not sure, new to nvim, but I am working off kickstart.nvim which I don't think adds any special config for telescope except keymaps
meetmangukiya commented 10 months ago

I think its because the position params built are built with window which uses current buffer https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/builtin/__lsp.lua#L268-L269

I think we need a vim.lsp.util.make_position_params_buffer(bufnr, ...) which doesn't seem to exist