Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 106 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ async function runCppcheckOnFileXML(

// Cppcheck line number is 1-indexed, while VS Code uses 0-indexing
const mainLoc = locations[locations.length - 1].$;

// If main location is not current file, then skip displaying warning
if (!filePath.endsWith(mainLoc.file)) {
continue;
}

const line = Number(mainLoc.line) - 1;
// Invalid line number usually means non-analysis output
if (isNaN(line) || line < 0 || line >= document.lineCount) {
Expand Down