Skip to content

Commit d6d3b7a

Browse files
committed
make linter args options configurable
1 parent 86a78f0 commit d6d3b7a

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@
8787
"type": "boolean",
8888
"default": true,
8989
"description": "Enables or disables the linter functionality"
90+
},
91+
"fortran.linterExtraArgs": {
92+
"type": ["array"],
93+
"items": { "type":"string"},
94+
"default": ["-Wall"],
95+
"description": "Specify additional options to use when calling the gfortran compiler"
9096
}
9197
}
9298
}

src/features/linter-provider.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,12 @@ export default class FortranLintingProvider {
2525
let decoded = '';
2626
let diagnostics: vscode.Diagnostic[] = [];
2727
let options = vscode.workspace.rootPath ? { cwd: vscode.workspace.rootPath } : undefined;
28-
let args = ['', textDocument.fileName];
28+
let args = [...this.getLinterExtraArgs(), "-cpp", "-fsyntax-only", '-fdiagnostics-show-option'];
2929
let includePaths = this.getIncludePaths();
3030
let command = this.getGfortranPath();
3131

3232
let childProcess = cp.spawn(command, [
33-
'-cpp',
34-
'-fsyntax-only',
35-
'-Wall',
36-
'-fdiagnostics-show-option',
33+
...args,
3734
getIncludeParams(includePaths), // include paths
3835
textDocument.fileName]);
3936

@@ -79,12 +76,13 @@ export default class FortranLintingProvider {
7976
private static commandId: string = 'fortran.lint.runCodeAction';
8077

8178
public provideCodeActions(document: vscode.TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken): vscode.Command[] {
82-
let diagnostic: vscode.Diagnostic = context.diagnostics[0];
83-
return [{
84-
title: "Accept gfortran suggestion",
85-
command: FortranLintingProvider.commandId,
86-
arguments: [document, diagnostic.range, diagnostic.message]
87-
}];
79+
return;
80+
// let diagnostic: vscode.Diagnostic = context.diagnostics[0];
81+
// return [{
82+
// title: "Accept gfortran suggestion",
83+
// command: FortranLintingProvider.commandId,
84+
// arguments: [document, diagnostic.range, diagnostic.message]
85+
// }];
8886
}
8987

9088
private command: vscode.Disposable;
@@ -122,5 +120,9 @@ export default class FortranLintingProvider {
122120
let config = vscode.workspace.getConfiguration('fortran');
123121
return config.get("gfortranExecutable","gfortran");
124122
}
123+
private getLinterExtraArgs():string[]{
124+
let config = vscode.workspace.getConfiguration('fortran');
125+
return config.get("linterExtraArgs",["-Wall"]);
126+
}
125127

126128
}

0 commit comments

Comments
 (0)