@@ -68,7 +68,10 @@ local all_namespaces = {}
68
68
--- @private
69
69
local function to_severity (severity )
70
70
if type (severity ) == ' string' then
71
- return assert (M .severity [string.upper (severity )], string.format (' Invalid severity: %s' , severity ))
71
+ return assert (
72
+ M .severity [string.upper (severity )],
73
+ string.format (' Invalid severity: %s' , severity )
74
+ )
72
75
end
73
76
return severity
74
77
end
@@ -277,7 +280,8 @@ local function set_diagnostic_cache(namespace, bufnr, diagnostics)
277
280
for _ , diagnostic in ipairs (diagnostics ) do
278
281
assert (diagnostic .lnum , ' Diagnostic line number is required' )
279
282
assert (diagnostic .col , ' Diagnostic column is required' )
280
- diagnostic .severity = diagnostic .severity and to_severity (diagnostic .severity ) or M .severity .ERROR
283
+ diagnostic .severity = diagnostic .severity and to_severity (diagnostic .severity )
284
+ or M .severity .ERROR
281
285
diagnostic .end_lnum = diagnostic .end_lnum or diagnostic .lnum
282
286
diagnostic .end_col = diagnostic .end_col or diagnostic .col
283
287
diagnostic .namespace = namespace
@@ -477,7 +481,8 @@ local function next_diagnostic(position, search_forward, bufnr, opts, namespace)
477
481
bufnr = get_bufnr (bufnr )
478
482
local wrap = vim .F .if_nil (opts .wrap , true )
479
483
local line_count = vim .api .nvim_buf_line_count (bufnr )
480
- local diagnostics = get_diagnostics (bufnr , vim .tbl_extend (' keep' , opts , { namespace = namespace }), true )
484
+ local diagnostics =
485
+ get_diagnostics (bufnr , vim .tbl_extend (' keep' , opts , { namespace = namespace }), true )
481
486
local line_diagnostics = diagnostic_lines (diagnostics )
482
487
for i = 0 , line_count do
483
488
local offset = i * (search_forward and 1 or - 1 )
@@ -966,7 +971,10 @@ M.handlers.virtual_text = {
966
971
if opts .virtual_text .format then
967
972
diagnostics = reformat_diagnostics (opts .virtual_text .format , diagnostics )
968
973
end
969
- if opts .virtual_text .source and (opts .virtual_text .source ~= ' if_many' or count_sources (bufnr ) > 1 ) then
974
+ if
975
+ opts .virtual_text .source
976
+ and (opts .virtual_text .source ~= ' if_many' or count_sources (bufnr ) > 1 )
977
+ then
970
978
diagnostics = prefix_source (diagnostics )
971
979
end
972
980
if opts .virtual_text .severity then
@@ -1274,7 +1282,9 @@ function M.open_float(opts, ...)
1274
1282
-- LSP servers can send diagnostics with `end_col` past the length of the line
1275
1283
local line_length = # vim .api .nvim_buf_get_lines (bufnr , lnum , lnum + 1 , true )[1 ]
1276
1284
diagnostics = vim .tbl_filter (function (d )
1277
- return d .lnum == lnum and math.min (d .col , line_length - 1 ) <= col and (d .end_col >= col or d .end_lnum > lnum )
1285
+ return d .lnum == lnum
1286
+ and math.min (d .col , line_length - 1 ) <= col
1287
+ and (d .end_col >= col or d .end_lnum > lnum )
1278
1288
end , diagnostics )
1279
1289
end
1280
1290
@@ -1328,9 +1338,10 @@ function M.open_float(opts, ...)
1328
1338
diagnostics = prefix_source (diagnostics )
1329
1339
end
1330
1340
1331
- local prefix_opt = if_nil (opts .prefix , (scope == ' cursor' and # diagnostics <= 1 ) and ' ' or function (_ , i )
1332
- return string.format (' %d. ' , i )
1333
- end )
1341
+ local prefix_opt =
1342
+ if_nil (opts .prefix , (scope == ' cursor' and # diagnostics <= 1 ) and ' ' or function (_ , i )
1343
+ return string.format (' %d. ' , i )
1344
+ end )
1334
1345
1335
1346
local prefix , prefix_hl_group
1336
1347
if prefix_opt then
0 commit comments