Skip to content

Commit b8f5adb

Browse files
committed
Linting now works with fixed form
Fixes Linting does not work for fixed format files #258
1 parent 1729769 commit b8f5adb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/features/linter-provider.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@
22

33
import * as path from 'path'
44
import * as cp from 'child_process'
5-
import { getIncludeParams, LANGUAGE_ID } from '../lib/helper'
5+
import { FORTRAN_DOCUMENT_SELECTOR, getIncludeParams } from '../lib/helper'
66

77
import * as vscode from 'vscode'
88
import { LoggingService } from '../services/logging-service'
99

1010
export default class FortranLintingProvider {
11-
constructor(private loggingService: LoggingService) {}
11+
constructor(private loggingService: LoggingService) { }
1212

1313
private diagnosticCollection: vscode.DiagnosticCollection
1414

1515
private doModernFortranLint(textDocument: vscode.TextDocument) {
1616
const errorRegex: RegExp =
1717
/^([a-zA-Z]:\\)*([^:]*):([0-9]+):([0-9]+):\s+(.*)\s+.*?\s+(Error|Warning|Fatal Error):\s(.*)$/gm
1818

19+
// Only lint Fortran (free, fixed) format files
1920
if (
20-
textDocument.languageId !== LANGUAGE_ID ||
21-
textDocument.uri.scheme !== 'file'
21+
FORTRAN_DOCUMENT_SELECTOR.some((element) => { element.language !== textDocument.languageId }) ||
22+
FORTRAN_DOCUMENT_SELECTOR.some((element) => { element.scheme !== textDocument.uri.scheme })
2223
) {
2324
return
2425
}

src/lib/helper.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { LoggingService } from '../services/logging-service';
77
// IMPORTANT: this should match the value
88
// on the package.json otherwise the extension won't
99
// work at all
10-
export const LANGUAGE_ID = 'FortranFreeForm';
1110
export const FORTRAN_DOCUMENT_SELECTOR = [
1211
{ scheme: 'file', language: 'FortranFreeForm' },
1312
{ scheme: 'file', language: 'FortranFixedForm' }

0 commit comments

Comments
 (0)