Files
neovim/runtime/doc
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-07 08:15:33 +02:00
2022-02-27 11:56:30 +01:00
2022-02-27 11:56:30 +01:00
2022-03-20 10:48:10 +01:00
2021-09-10 08:48:27 +02:00
2022-02-27 11:56:30 +01:00
2022-02-27 11:56:30 +01:00
2022-07-17 04:14:04 -07:00
2018-10-29 09:55:07 +01:00
2022-01-11 14:14:17 +01:00
2022-02-27 11:56:30 +01:00
2021-09-09 00:37:59 -07:00
2022-01-04 11:07:40 -07:00
2018-08-25 15:25:49 +02:00
2021-04-28 21:29:57 -04:00
2022-01-11 14:14:17 +01:00
2022-03-25 19:57:59 +01:00
2019-03-26 19:55:33 +01:00
2022-07-17 04:14:04 -07:00
2018-10-29 09:55:07 +01:00
2022-01-29 23:15:22 +00:00
2022-06-17 20:38:21 +02:00
2018-10-29 09:55:07 +01:00
2018-10-29 09:55:07 +01:00
2015-08-15 15:25:30 -03:00
2021-11-17 10:02:59 +01:00
2022-02-27 11:56:30 +01:00
2022-07-02 11:06:03 +02:00
2019-03-26 19:55:33 +01:00
2022-03-17 13:21:24 +08:00
2021-09-10 08:48:27 +02:00
2022-02-27 11:56:30 +01:00
2022-02-27 11:56:30 +01:00
2022-07-17 04:14:04 -07:00
2022-07-02 11:06:03 +02:00
2022-03-20 10:48:10 +01:00
2022-01-29 23:15:22 +00:00
2022-02-27 11:56:30 +01:00
2021-04-27 09:21:30 -04:00
2021-05-02 13:00:38 -04:00
2021-05-01 23:19:57 -04:00
2022-06-04 11:56:36 +08:00
2021-09-08 07:24:12 -07:00
2021-05-01 22:29:02 -04:00
2021-05-02 12:53:49 -04:00
2021-11-22 10:53:57 +01:00
2021-05-01 22:29:03 -04:00
2021-04-27 09:21:33 -04:00
2018-10-29 10:01:44 +01:00
2021-04-29 09:27:19 -04:00
2018-10-29 10:01:44 +01:00
2022-03-20 10:48:10 +01:00
2021-04-29 20:42:16 -04:00
2021-04-29 20:42:16 -04:00
2018-10-29 10:01:44 +01:00
2022-06-23 15:57:51 +02:00
2022-06-23 15:57:51 +02:00
2019-03-26 19:55:33 +01:00
2021-04-27 09:21:34 -04:00
2022-06-25 21:56:51 +02:00
2021-05-01 23:19:57 -04:00