Skip to content

Commit e59b384

Browse files
committed
Make linter point to the full compiler path
Fixes #500
1 parent fd7839d commit e59b384

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CHANGELOG.md

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

3636
### Changed
3737

38+
- Changed `linter.compilerPath` to use the full path to the compiler instead of the root
39+
([#500](https://github.com/fortran-lang/vscode-fortran-support/issues/500))
3840
- Changed all instances of the publisher to `fortran-lang`
3941
([#450](https://github.com/fortran-lang/vscode-fortran-support/issues/450))
4042
- Updated grammar unittests to include scope injections

src/features/linter-provider.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import * as path from 'path';
44
import * as cp from 'child_process';
5+
import which from 'which';
56

67
import * as vscode from 'vscode';
78
import { LoggingService } from '../services/logging-service';
@@ -221,19 +222,17 @@ export class FortranLintingProvider {
221222
}
222223

223224
/**
224-
* Returns the linter executable
225+
* Returns the linter executable i.e. this.compilerPath
225226
* @returns String with linter
226227
*/
227228
private getLinterExecutable(): string {
228229
const config = vscode.workspace.getConfiguration('fortran.linter');
229230

230231
this.compiler = config.get<string>('compiler', 'gfortran');
231232
this.compilerPath = config.get<string>('compilerPath', '');
232-
const linter = path.join(this.compilerPath, this.compiler);
233-
234-
this.logger.logInfo(`using linter: ${this.compiler} located in: ${linter}`);
235-
236-
return linter;
233+
if (this.compilerPath === '') this.compilerPath = which.sync(this.compiler);
234+
this.logger.logInfo(`using linter: ${this.compiler} located in: ${this.compilerPath}`);
235+
return this.compilerPath;
237236
}
238237

239238
/**

0 commit comments

Comments
 (0)