@@ -32,31 +32,6 @@ local function check_cond(cond, client, bufnr)
3232 return true
3333end
3434
35- --- A table of settings for different levels of diagnostics
36- M .diagnostics = { [0 ] = {}, {}, {}, {} }
37-
38- local function setup_diagnostics ()
39- for name , dict in pairs (M .config .signs or {}) do
40- if dict then vim .fn .sign_define (name , dict ) end
41- end
42- M .diagnostics = {
43- -- diagnostics off
44- [0 ] = vim .tbl_deep_extend (
45- " force" ,
46- M .config .diagnostics ,
47- { underline = false , virtual_text = false , signs = false , update_in_insert = false }
48- ),
49- -- status only
50- vim .tbl_deep_extend (" force" , M .config .diagnostics , { virtual_text = false , signs = false }),
51- -- virtual text off, signs on
52- vim .tbl_deep_extend (" force" , M .config .diagnostics , { virtual_text = false }),
53- -- all diagnostics on
54- M .config .diagnostics ,
55- }
56-
57- vim .diagnostic .config (M .diagnostics [M .config .features .diagnostics_mode ])
58- end
59-
6035--- Helper function to set up a given server with the Neovim LSP client
6136--- @param server string The name of the server to be setup
6237function M .lsp_setup (server )
224199function M .setup (opts )
225200 M .config = vim .tbl_deep_extend (" force" , M .config , opts )
226201
227- -- TODO: Remove when dropping support for Neovim v0.9
228- -- Backwards compatibility of new diagnostic sign API to Neovim v0.9
229- if vim .fn .has " nvim-0.10" ~= 1 then
230- local signs = vim .tbl_get (M .config , " diagnostics" , " signs" ) or {}
231- if not M .config .signs then M .config .signs = {} end
232- for _ , type in ipairs { " Error" , " Hint" , " Info" , " Warn" } do
233- local name , severity = " DiagnosticSign" .. type , vim .diagnostic .severity [type :upper ()]
234- if M .config .signs [name ] == nil then M .config .signs [name ] = { text = " " } end
235- if M .config .signs [name ] then
236- if not M .config .signs [name ].texthl then M .config .signs [name ].texthl = name end
237- for attribute , severities in pairs (signs ) do
238- if severities [severity ] then M .config .signs [name ][attribute ] = severities [severity ] end
239- end
240- end
241- end
242- end
243-
244- setup_diagnostics ()
245-
246202 -- normalize format_on_save to table format
247203 if vim .tbl_get (M .config , " formatting" , " format_on_save" ) == false then
248204 M .config .formatting .format_on_save = { enabled = false }
0 commit comments