Skip to content
This repository was archived by the owner on Sep 24, 2024. It is now read-only.

Commit 00818f0

Browse files
authored
Merge pull request #55 from csaez/neovim-compatibility
Adds backward compatibility with neovim<0.5
2 parents f42db17 + aa5766a commit 00818f0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

autoload/lsp_cxx_hl/client/nvim_lsp.vim

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,27 @@ endfunction
1515

1616
function! s:doinit() abort
1717
lua <<EOF
18-
vim.lsp.callbacks['$cquery/publishSemanticHighlighting'] = function(err, method, params, client_id)
18+
handlers = vim.lsp.handlers
19+
20+
--[ backwards compatibility with neovim<0.5 --]
21+
if (handlers == nil)
22+
then
23+
handlers = vim.lsp.callbacks
24+
end
25+
26+
handlers['$cquery/publishSemanticHighlighting'] = function(err, method, params, client_id)
1927
vim.api.nvim_call_function('lsp_cxx_hl#client#nvim_lsp#cquery_hl', {params})
2028
end
2129

22-
vim.lsp.callbacks['$cquery/setInactiveRegions'] = function(err, method, params, client_id)
30+
handlers['$cquery/setInactiveRegions'] = function(err, method, params, client_id)
2331
vim.api.nvim_call_function('lsp_cxx_hl#client#nvim_lsp#cquery_regions', {params})
2432
end
2533

26-
vim.lsp.callbacks['$ccls/publishSemanticHighlight'] = function(err, method, params, client_id)
34+
handlers['$ccls/publishSemanticHighlight'] = function(err, method, params, client_id)
2735
vim.api.nvim_call_function('lsp_cxx_hl#client#nvim_lsp#ccls_hl', {params})
2836
end
2937

30-
vim.lsp.callbacks['$ccls/publishSkippedRanges'] = function(err, method, params, client_id)
38+
handlers['$ccls/publishSkippedRanges'] = function(err, method, params, client_id)
3139
vim.api.nvim_call_function('lsp_cxx_hl#client#nvim_lsp#ccls_regions', {params})
3240
end
3341
EOF

0 commit comments

Comments
 (0)