Skip to content

Commit 9cfee5a

Browse files
committed
Linting now works with fixed form
Fixes Linting does not work for fixed format files #258
1 parent 2667ea5 commit 9cfee5a

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
## Fixed
1111

1212
- Extension now activates for `FortranFixedForm`
13+
- Linting is now operational for `FortranFixedForm`
1314

1415
## Changed
1516

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)