Skip to content

Commit 1627b79

Browse files
authored
Merge pull request #761 from fortran-lang/gnikit/issue759
fix(linter): make version regex more permissive
2 parents d196ab5 + ac0933c commit 1627b79

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-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 regular expression for parsing version of GFortran in linter
78+
([#759](https://github.com/fortran-lang/vscode-fortran-support/issues/759))
7779
- Fixed bug where diagnostic messages would linger from the previous state
7880
([#706](https://github.com/fortran-lang/vscode-fortran-support/issues/706))
7981
- Fixed activation bug on Windows causing the persistent cache to fail

src/features/linter-provider.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ export class LinterSettings {
9797
}
9898
// State the variables explicitly bc the TypeScript compiler on the CI
9999
// seemed to optimise away the stdout and regex would return null
100-
const regex = /^GNU Fortran \([\w.-]+\) (?<version>.*)$/gm;
100+
// The words between the parenthesis can have all sorts of special characters
101+
// account for all of them just to be safe
102+
const regex = /^GNU Fortran \([\S ]+\) (?<version>.*)$/gm;
101103
const output = child.stdout.toString();
102104
const match = regex.exec(output);
103105
const version = match ? match.groups.version : undefined;
@@ -107,7 +109,7 @@ export class LinterSettings {
107109
this.logger.debug(`[lint] Using Modern GNU Fortran diagnostics: ${this.modernGNU}`);
108110
return version;
109111
} else {
110-
this.logger.error(`[lint] invalid compiler version: ${version}`);
112+
this.logger.error(`[lint] invalid compiler version extracted ${version} from ${output}`);
111113
}
112114
}
113115

0 commit comments

Comments
 (0)