Skip to content

Commit

Permalink
Fix parsing of line-only locations.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Nov 14, 2024
1 parent e540989 commit 839d757
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/debug/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ export class Session {
const items = await this.listItemsInScope(scope);
for (const [itemName, itemDesc] of Object.entries(items)) {
const itemLocation = Location.fromCXXRTL(itemDesc.src);
console.log(itemLocation, filename, position, itemLocation !== null && matchLocation(itemLocation, filename, position));
if (itemLocation !== null && matchLocation(itemLocation, filename, position)) {
variables.push(Variable.fromCXXRTL(itemName, itemDesc));
}
Expand Down
8 changes: 4 additions & 4 deletions src/model/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export class Location {
return new Location(
matches[1],
parseInt(matches[2]) - 1,
matches.length >= 4 ? parseInt(matches[3]) - 1 : undefined,
matches.length >= 4 ? parseInt(matches[4]) - 1 : undefined,
matches.length >= 6 ? parseInt(matches[5]) - 1 : undefined,
matches[3] !== undefined ? parseInt(matches[3]) - 1 : undefined,
matches[4] !== undefined ? parseInt(matches[4]) - 1 : undefined,
matches[5] !== undefined ? parseInt(matches[5]) - 1 : undefined,
);
}

Expand All @@ -36,7 +36,7 @@ export class Location {
this.startLine,
this.startColumn ?? 0,
this.endLine ?? this.startLine,
this.endColumn ?? this.startColumn ?? 0
this.endColumn ?? 4096
);
}

Expand Down

0 comments on commit 839d757

Please sign in to comment.