@@ -62,18 +62,17 @@ export abstract class BaseLinter {
6262 return Promise . resolve ( [ ] ) ;
6363 }
6464
65- protected run ( commandLine : string , filePath : string , txtDocumentLines : string [ ] , regEx : string = REGEX ) : Promise < ILintMessage [ ] > {
65+ protected run ( commandLine : string , filePath : string , txtDocumentLines : string [ ] , cwd : string , regEx : string = REGEX ) : Promise < ILintMessage [ ] > {
6666 var outputChannel = this . outputChannel ;
6767 var linterId = this . Id ;
6868
6969 return new Promise < ILintMessage [ ] > ( ( resolve , reject ) => {
70- var fileDir = path . dirname ( filePath ) ;
71- sendCommand ( commandLine , fileDir , true ) . then ( data => {
70+ sendCommand ( commandLine , cwd , true ) . then ( data => {
7271 outputChannel . clear ( ) ;
73- outputChannel . append ( data ) ;
72+ outputChannel . append ( data ) ;
7473 var outputLines = data . split ( / \r ? \n / g) ;
7574 var diagnostics : ILintMessage [ ] = [ ] ;
76- outputLines . filter ( ( value , index ) => index <= this . pythonSettings . linting . maxNumberOfProblems ) . forEach ( line => {
75+ outputLines . filter ( ( value , index ) => index <= this . pythonSettings . linting . maxNumberOfProblems ) . forEach ( line => {
7776 var match = matchNamedRegEx ( line , regEx ) ;
7877 if ( match == null ) {
7978 return ;
@@ -86,7 +85,7 @@ export abstract class BaseLinter {
8685 var sourceLine = txtDocumentLines [ match . line - 1 ] ;
8786 var sourceStart = sourceLine . substring ( match . column - 1 ) ;
8887 var endCol = txtDocumentLines [ match . line - 1 ] . length ;
89-
88+
9089 //try to get the first word from the startig position
9190 var possibleProblemWords = sourceStart . match ( / \w + / g) ;
9291 var possibleWord : string ;
@@ -111,7 +110,7 @@ export abstract class BaseLinter {
111110 } ) ;
112111
113112 resolve ( diagnostics ) ;
114- } , error => {
113+ } , error => {
115114 outputChannel . appendLine ( `Linting with ${ linterId } failed. If not installed please turn if off in settings.\n ${ error } ` ) ;
116115 window . showInformationMessage ( `Linting with ${ linterId } failed. If not installed please turn if off in settings. View Python output for details.` ) ;
117116 } ) ;
0 commit comments