@@ -259,6 +259,9 @@ function! s:newlsp() abort
259
259
endif
260
260
261
261
for l: diag in l: data .diagnostics
262
+ if l: level < l: diag .severity
263
+ continue
264
+ endif
262
265
let [l: error , l: matchpos ] = s: errorFromDiagnostic (l: diag , l: bufname , l: fname )
263
266
let l: diagnostics = add (l: diagnostics , l: error )
264
267
@@ -1428,23 +1431,27 @@ function! s:highlightMatches(errorMatches, warningMatches) abort
1428
1431
1429
1432
if hlexists (' goDiagnosticError' )
1430
1433
" clear the old matches just before adding the new ones to keep flicker
1431
- " to a minimum.
1434
+ " to a minimum and clear before checking the level so that if the user
1435
+ " changed the level since the last highlighting, the highlighting will be
1436
+ " be properly cleared.
1432
1437
call go#util#ClearHighlights (' goDiagnosticError' )
1433
- if go#config#HighlightDiagnosticErrors ()
1438
+ if go#config#DiagnosticsLevel () >= 2
1434
1439
let b: go_diagnostic_matches .errors = copy (a: errorMatches )
1435
- if go#config#DiagnosticsLevel () >= 2
1440
+ if go#config#HighlightDiagnosticErrors ()
1436
1441
call go#util#HighlightPositions (' goDiagnosticError' , a: errorMatches )
1437
1442
endif
1438
1443
endif
1439
1444
endif
1440
1445
1441
1446
if hlexists (' goDiagnosticWarning' )
1442
1447
" clear the old matches just before adding the new ones to keep flicker
1443
- " to a minimum.
1448
+ " to a minimum and clear before checking the level so that if the user
1449
+ " changed the level since the last highlighting, the highlighting will be
1450
+ " be properly cleared.
1444
1451
call go#util#ClearHighlights (' goDiagnosticWarning' )
1445
- if go#config#HighlightDiagnosticWarnings ()
1452
+ if go#config#DiagnosticsLevel () >= 2
1446
1453
let b: go_diagnostic_matches .warnings = copy (a: warningMatches )
1447
- if go#config#DiagnosticsLevel () >= 2
1454
+ if go#config#HighlightDiagnosticWarnings ()
1448
1455
call go#util#HighlightPositions (' goDiagnosticWarning' , a: warningMatches )
1449
1456
endif
1450
1457
endif
0 commit comments