diff options
| author | Christian Clason <christian.clason@uni-due.de> | 2021-09-10 10:10:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-10 01:10:18 -0700 |
| commit | 38e489a12e991e0dd762de1adac976920fb438b5 (patch) | |
| tree | 627e8d3901b08a5059b4f7422b205ff12fb7b097 /lua/lspconfig/clangd.lua | |
| parent | [docgen] Update CONFIG.md (diff) | |
| download | nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar.gz nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar.bz2 nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar.lz nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar.xz nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.tar.zst nvim-lspconfig-38e489a12e991e0dd762de1adac976920fb438b5.zip | |
fix: add compat shim for handler change in core (#1248)
Add a compatibility shim to `util.lua` adapting to change in handler signature
and use it where needed.
(Skip `rust-analyzer` and `denols` since their requests don't use handlers.)
Diffstat (limited to 'lua/lspconfig/clangd.lua')
| -rw-r--r-- | lua/lspconfig/clangd.lua | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lua/lspconfig/clangd.lua b/lua/lspconfig/clangd.lua index 22c89e52..e8876af6 100644 --- a/lua/lspconfig/clangd.lua +++ b/lua/lspconfig/clangd.lua @@ -5,16 +5,21 @@ local util = require 'lspconfig/util' local function switch_source_header(bufnr) bufnr = util.validate_bufnr(bufnr) local params = { uri = vim.uri_from_bufnr(bufnr) } - vim.lsp.buf_request(bufnr, 'textDocument/switchSourceHeader', params, function(err, _, result) - if err then - error(tostring(err)) - end - if not result then - print 'Corresponding file cannot be determined' - return - end - vim.api.nvim_command('edit ' .. vim.uri_to_fname(result)) - end) + vim.lsp.buf_request( + bufnr, + 'textDocument/switchSourceHeader', + params, + util.compat_handler(function(err, result) + if err then + error(tostring(err)) + end + if not result then + print 'Corresponding file cannot be determined' + return + end + vim.api.nvim_command('edit ' .. vim.uri_to_fname(result)) + end) + ) end local root_pattern = util.root_pattern('compile_commands.json', 'compile_flags.txt', '.git') |
