@@ -247,27 +247,6 @@ export class FortranLintingProvider {
247247 this . subscriptions = [ ] ;
248248 }
249249
250- /**
251- * Lint a document using the specified linter options
252- * @param document TextDocument to lint
253- * @returns An array of vscode.Diagnostic[]
254- */
255- private async doLint ( document : vscode . TextDocument ) : Promise < vscode . Diagnostic [ ] > | undefined {
256- // Only lint if a compiler is specified
257- if ( ! this . settings . enabled ) return ;
258- // Only lint Fortran (free, fixed) format files
259- if ( ! isFortran ( document ) ) return ;
260-
261- const output = await this . doBuild ( document ) ;
262- if ( ! output ) return ;
263-
264- let diagnostics : vscode . Diagnostic [ ] = this . linter . parse ( output ) ;
265- // Remove duplicates from the diagnostics array
266- diagnostics = [ ...new Map ( diagnostics . map ( v => [ JSON . stringify ( v ) , v ] ) ) . values ( ) ] ;
267- this . fortranDiagnostics . set ( document . uri , diagnostics ) ;
268- return diagnostics ;
269- }
270-
271250 /**
272251 * Scan the workspace for Fortran files and lint them
273252 */
@@ -338,6 +317,27 @@ export class FortranLintingProvider {
338317 } ) ;
339318 }
340319
320+ /**
321+ * Lint a document using the specified linter options
322+ * @param document TextDocument to lint
323+ * @returns An array of vscode.Diagnostic[]
324+ */
325+ private async doLint ( document : vscode . TextDocument ) : Promise < vscode . Diagnostic [ ] > | undefined {
326+ // Only lint if a compiler is specified
327+ if ( ! this . settings . enabled ) return ;
328+ // Only lint Fortran (free, fixed) format files
329+ if ( ! isFortran ( document ) ) return ;
330+
331+ const output = await this . doBuild ( document ) ;
332+ if ( ! output ) return ;
333+
334+ let diagnostics : vscode . Diagnostic [ ] = this . linter . parse ( output ) ;
335+ // Remove duplicates from the diagnostics array
336+ diagnostics = [ ...new Map ( diagnostics . map ( v => [ JSON . stringify ( v ) , v ] ) ) . values ( ) ] ;
337+ this . fortranDiagnostics . set ( document . uri , diagnostics ) ;
338+ return diagnostics ;
339+ }
340+
341341 private async doBuild ( document : vscode . TextDocument ) : Promise < string > | undefined {
342342 this . linter = this . getLinter ( this . settings . compiler ) ;
343343 const command = this . settings . compilerExe ;
0 commit comments