diff --git a/CHANGELOG.md b/CHANGELOG.md index 03d6a054..7fd5fbae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed +- Changed `linter.compilerPath` to use the full path to the compiler instead of the root + ([#500](https://github.com/fortran-lang/vscode-fortran-support/issues/500)) - Changed all instances of the publisher to `fortran-lang` ([#450](https://github.com/fortran-lang/vscode-fortran-support/issues/450)) - Updated grammar unittests to include scope injections diff --git a/src/features/linter-provider.ts b/src/features/linter-provider.ts index 4eb688b9..02b0971a 100644 --- a/src/features/linter-provider.ts +++ b/src/features/linter-provider.ts @@ -2,6 +2,7 @@ import * as path from 'path'; import * as cp from 'child_process'; +import which from 'which'; import * as vscode from 'vscode'; import { LoggingService } from '../services/logging-service'; @@ -221,7 +222,7 @@ export class FortranLintingProvider { } /** - * Returns the linter executable + * Returns the linter executable i.e. this.compilerPath * @returns String with linter */ private getLinterExecutable(): string { @@ -229,11 +230,9 @@ export class FortranLintingProvider { this.compiler = config.get('compiler', 'gfortran'); this.compilerPath = config.get('compilerPath', ''); - const linter = path.join(this.compilerPath, this.compiler); - - this.logger.logInfo(`using linter: ${this.compiler} located in: ${linter}`); - - return linter; + if (this.compilerPath === '') this.compilerPath = which.sync(this.compiler); + this.logger.logInfo(`using linter: ${this.compiler} located in: ${this.compilerPath}`); + return this.compilerPath; } /** diff --git a/test/index.ts b/test/index.ts index ebc5b308..5778e72f 100644 --- a/test/index.ts +++ b/test/index.ts @@ -1,6 +1,6 @@ -import * as path from 'path'; -import * as Mocha from 'mocha'; -import * as glob from 'glob'; +import path from 'path'; +import Mocha from 'mocha'; +import glob from 'glob'; export function run(): Promise { // Create the mocha test diff --git a/tsconfig.test.json b/tsconfig.test.json index 293fd34f..56f86fe8 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -6,7 +6,9 @@ "lib": ["ES2020"], "sourceMap": true, "rootDir": ".", - "resolveJsonModule": true + "resolveJsonModule": true, + "esModuleInterop": true, + "removeComments": true }, "include": ["test/**/*.ts", "syntaxes/*.json"], "exclude": ["node_modules", ".vscode-test"]