diff --git a/src/extension.ts b/src/extension.ts index f449756..8949eab 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -258,8 +258,9 @@ async function runCppcheckOnFileXML( // Related Information const relatedInfos: vscode.DiagnosticRelatedInformation[] = []; - for (let i = 0; i < locations.length; i++) { - const loc = locations[i].$; + for (let i = 1; i <= locations.length; i++) { + // Related information is ordered in reverse in XML object + const loc = locations[locations.length - i].$; const msg = loc.info; const lLine = Number(loc.line) - 1; @@ -290,4 +291,4 @@ async function runCppcheckOnFileXML( } // This method is called when your extension is deactivated -export function deactivate() {} \ No newline at end of file +export function deactivate() {}