File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -254,23 +254,24 @@ async function runCppcheckOnFileXML(
254254 continue ;
255255 }
256256
257- // Cppcheck line number is 1-indexed, while VS Code uses 0-indexing
258257 const mainLoc = locations [ locations . length - 1 ] . $ ;
259258
260259 // If main location is not current file, then skip displaying warning
261260 if ( ! filePath . endsWith ( mainLoc . file ) ) {
262261 continue ;
263262 }
264263
264+ // Cppcheck line number is 1-indexed, while VS Code uses 0-indexing
265265 const line = Number ( mainLoc . line ) - 1 ;
266266 // Invalid line number usually means non-analysis output
267267 if ( isNaN ( line ) || line < 0 || line >= document . lineCount ) {
268268 continue ;
269269 }
270270
271+ // Cppcheck col number is 1-indexed, while VS Code uses 0-indexing
271272 let col = Number ( mainLoc . column ) - 1 ;
272273 if ( isNaN ( col ) || col < 0 || col > document . lineAt ( line ) . text . length ) {
273- col = 1 ;
274+ col = 0 ;
274275 }
275276
276277 const severity = parseSeverity ( e . $ . severity ) ;
You can’t perform that action at this time.
0 commit comments