Skip to content

Commit b1d5164

Browse files
committed
fix(linter): lingering linter diagnostics
Fixes #706
1 parent 3b7cfc1 commit b1d5164

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7474

7575
### Fixed
7676

77+
- Fixed bug where diagnostic messages would linger from the previous state
78+
([#706](https://github.com/fortran-lang/vscode-fortran-support/issues/706))
7779
- Fixed activation bug on Windows causing the persistent cache to fail
7880
([#700](https://github.com/fortran-lang/vscode-fortran-support/issues/700))
7981
- Fixed bug where the linter's internal cache directory would not always exist

src/features/linter-provider.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,12 @@ export class FortranLintingProvider {
329329
if (!isFortran(document)) return;
330330

331331
const output = await this.doBuild(document);
332-
if (!output) return;
333-
332+
if (!output) {
333+
// If the linter output is now empty, then there are no errors.
334+
// Discard the previous diagnostic state for this document
335+
if (this.fortranDiagnostics.has(document.uri)) this.fortranDiagnostics.delete(document.uri);
336+
return;
337+
}
334338
let diagnostics: vscode.Diagnostic[] = this.linter.parse(output);
335339
// Remove duplicates from the diagnostics array
336340
diagnostics = [...new Map(diagnostics.map(v => [JSON.stringify(v), v])).values()];

0 commit comments

Comments
 (0)