Files
neovim/runtime
Dalius Dobravolskas 3ded2ab55a feat(lsp): allow passing custom list handler to LSP functions that return lists (#19213)
Currently LSP allows only using loclist or quickfix list window. I
normally prefer to review all quickfix items without opening quickfix
window. This fix allows passing `on_list` option which allows full
control what to do with list.

Here is example how to use it with quick fix list:

```lua
local function on_list(options)
  vim.fn.setqflist({}, ' ', options)
  vim.api.nvim_command('cfirst')
end

local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', '<leader>ad', function() vim.lsp.buf.declaration{on_list=on_list} end, bufopts)
vim.keymap.set('n', '<leader>d', function() vim.lsp.buf.definition{on_list=on_list} end, bufopts)
vim.keymap.set('n', '<leader>ai', function() vim.lsp.buf.implementation{on_list=on_list} end, bufopts)
vim.keymap.set('n', '<leader>at', function() vim.lsp.buf.type_definition{on_list=on_list} end, bufopts)
vim.keymap.set('n', '<leader>af', function() vim.lsp.buf.references(nil, {on_list=on_list}) end, bufopts)
```

If you prefer loclist do something like this:

```lua
local function on_list(options)
  vim.fn.setloclist(0, {}, ' ', options)
  vim.api.nvim_command('lopen')
end
```

close #19182

Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2022-07-25 23:02:51 +02:00
..
2022-07-17 14:33:51 +02:00
2022-06-15 09:20:32 +02:00
2022-06-17 20:38:21 +02:00
2022-07-02 11:06:03 +02:00
2022-06-24 14:45:07 +02:00
2021-09-13 16:33:41 +02:00
2021-05-01 22:29:03 -04:00
2014-12-19 15:28:49 -05:00
2021-03-09 19:21:26 +01:00
2021-11-27 19:39:42 +01:00
2019-07-29 20:50:07 +02:00
2022-07-17 14:33:51 +02:00
2021-04-27 09:21:32 -04:00
2019-07-29 20:50:07 +02:00
2022-04-15 13:38:44 +02:00
2022-06-04 11:56:36 +08:00
2021-05-01 22:29:02 -04:00