File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,9 +53,10 @@ export class Linter extends baseLinter.BaseLinter {
5353 let diagnostics : baseLinter . ILintMessage [ ] = [ ] ;
5454 parsedData . messages . filter ( ( value , index ) => index <= this . pythonSettings . linting . maxNumberOfProblems ) . forEach ( msg => {
5555
56- let sourceLine = txtDocumentLines [ msg . location . line - 1 ] ;
56+ let lineNumber = msg . location . line === null || isNaN ( msg . location . line ) ? 1 : msg . location . line ;
57+ let sourceLine = txtDocumentLines [ lineNumber - 1 ] ;
5758 let sourceStart = sourceLine . substring ( msg . location . character ) ;
58- let endCol = txtDocumentLines [ msg . location . line - 1 ] . length ;
59+ let endCol = txtDocumentLines [ lineNumber - 1 ] . length ;
5960
6061 // try to get the first word from the starting position
6162 let possibleProblemWords = sourceStart . match ( / \w + / g) ;
@@ -68,7 +69,7 @@ export class Linter extends baseLinter.BaseLinter {
6869 code : msg . code ,
6970 message : msg . message ,
7071 column : msg . location . character ,
71- line : msg . location . line ,
72+ line : lineNumber ,
7273 possibleWord : possibleWord ,
7374 type : msg . code ,
7475 provider : `${ this . Id } - ${ msg . source } `
You can’t perform that action at this time.
0 commit comments