Skip to content

Commit 809b463

Browse files
fix #4: notes are shown in the wrong order (#11)
* fix/notes are shown in the wrong order * remove console log (#12) --------- Co-authored-by: davidramneroluma <david.ramnero@luma.energy>
1 parent 970e407 commit 809b463

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/extension.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,9 @@ async function runCppcheckOnFileXML(
270270

271271
// Related Information
272272
const relatedInfos: vscode.DiagnosticRelatedInformation[] = [];
273-
for (let i = 0; i < locations.length; i++) {
274-
const loc = locations[i].$;
273+
for (let i = 1; i <= locations.length; i++) {
274+
// Related information is ordered in reverse in XML object
275+
const loc = locations[locations.length - i].$;
275276
const msg = loc.info;
276277
const lLine = Number(loc.line) - 1;
277278

@@ -302,4 +303,4 @@ async function runCppcheckOnFileXML(
302303
}
303304

304305
// This method is called when your extension is deactivated
305-
export function deactivate() {}
306+
export function deactivate() {}

0 commit comments

Comments
 (0)