File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 3
3
import * as path from 'path' ;
4
4
import * as cp from 'child_process' ;
5
5
import ChildProcess = cp . ChildProcess ;
6
- import { getIncludeParams , LANGUAGE_ID } from '../lib/helper' ;
6
+ import { getIncludeParams , LANGUAGE_ID , extract_path } from '../lib/helper' ;
7
7
8
8
import * as vscode from 'vscode' ;
9
9
@@ -28,8 +28,9 @@ export default class FortranLintingProvider {
28
28
let diagnostics : vscode . Diagnostic [ ] = [ ] ;
29
29
let command = this . getGfortranPath ( ) ;
30
30
let argList = this . constructArgumentList ( textDocument ) ;
31
-
32
- let childProcess = cp . spawn ( command , argList ) ;
31
+
32
+ let filePath = extract_path ( textDocument . fileName ) ;
33
+ let childProcess = cp . spawn ( command , argList , { cwd : filePath } ) ;
33
34
34
35
if ( childProcess . pid ) {
35
36
childProcess . stdout . on ( 'data' , ( data : Buffer ) => {
Original file line number Diff line number Diff line change 1
1
2
2
import * as fs from 'fs' ;
3
3
import * as vscode from 'vscode' ;
4
-
4
+ let path = require ( 'path' ) ;
5
+ const fileSep = path . sep ;
5
6
6
7
export const LANGUAGE_ID = 'fortran90' ;
7
8
@@ -106,4 +107,10 @@ let saveKeywordToJson = (keyword) => {
106
107
if ( err ) throw err ;
107
108
console . log ( 'Saved!' ) ;
108
109
} ) ;
109
- } ;
110
+ } ;
111
+
112
+ export const extract_path = ( file : string ) => {
113
+
114
+ let pos = file . lastIndexOf ( fileSep ) ;
115
+ return file . substring ( 0 , pos ) ;
116
+ } ;
You can’t perform that action at this time.
0 commit comments