Skip to content

Commit

Permalink
#325 set correct line for subItems copied from local definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Altmeyer committed Sep 12, 2024
1 parent 8f22533 commit a594fe5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion language/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,18 @@ export default class Parser {
for (let i = scopes.length - 1; i >= 0; i--) {
const valuePointer = scopes[i].structs.find(struct => struct.name.toUpperCase() === keywordValue);
if (valuePointer) {
ds.subItems = valuePointer.subItems;
// Only use same subItems if local definition is from same path
if (ds.position.path === valuePointer.position.path) {
ds.subItems = valuePointer.subItems;
} else {
// Clone subitems for correct line assignment
valuePointer.subItems.forEach((item) => {
const newItem = item.clone();
newItem.position.line = ds.position.line;
ds.subItems.push(newItem);
});
}

return;
}
}
Expand Down

0 comments on commit a594fe5

Please sign in to comment.