From 3e00d4f01cebedb758050e2e3faf065036fcfdc2 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Mon, 26 Jul 2021 12:39:50 -0600 Subject: feat(lsp): make list handlers configurable (#15199) The handlers for textDocument/references, textDocument/documentSymbol, and workspace/symbol open their results in the quickfix list by default and are not configurable. They are also incompatible with `vim.lsp.with` as they do not accept a configuration parameter. Add a `config` parameter to the handler for these three messages which allows them to be configured with `vim.lsp.with`. Additionally, add a new configuration option 'loclist' that, when true, causes these handlers to open their results in the location list rather than the quickfix list. --- runtime/doc/lsp.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index a15c74d148..5a27e195bc 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -321,6 +321,18 @@ To configure the behavior of a builtin |lsp-handler|, the convenient method ), } } +< + Some handlers do not have an explicitly named handler function (such as + |on_publish_diagnostics()|). To override these, first create a reference + to the existing handler: > + + local on_references = vim.lsp.handlers["textDocument/references"] + vim.lsp.handlers["textDocument/references"] = vim.lsp.with( + on_references, { + -- Use location list instead of quickfix list + loclist = true, + } + ) < *lsp-handler-resolution* Handlers can be set by: -- cgit