@@ -15,19 +15,27 @@ endfunction
1515
1616function ! s: doinit () abort
1717lua <<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})
2028end
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})
2432end
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})
2836end
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})
3240end
3341EOF
0 commit comments