Skip to content

Commit 64912a3

Browse files
authored
feat: ignore duplicates for calcpvrs starting with _ (#888)
Ignore duplicates for calcpvrs starting with _
1 parent 465ec46 commit 64912a3

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

packages/septic/src/diagnostics.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,9 @@ function validateCalcPvrIdentifierReferences(
940940
contextProvider: SepticContext,
941941
doc: TextDocument,
942942
): SepticDiagnostic[] {
943+
if (obj.identifier?.name.startsWith("_")) {
944+
return [];
945+
}
943946
const diagnostics: SepticDiagnostic[] = [];
944947
if (
945948
contextProvider.validateReferences(

packages/septic/src/test/diagnostics.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,25 @@ describe("Test validation of object references", () => {
14271427
);
14281428
expect(diagFilterd.length).to.equal(1);
14291429
});
1430+
it("Expect no diagnostics for duplicate calcpvr starting with _", () => {
1431+
const text = `
1432+
CalcPvr: _Test
1433+
1434+
CalcPvr: _Test
1435+
`;
1436+
const cnfg = parseSepticForTest(text);
1437+
const objectInfo = metaInfoProvider.getObject("CalcPvr");
1438+
const diag = validateObjectReferences(
1439+
cnfg.objects[0]!,
1440+
cnfg.doc,
1441+
cnfg,
1442+
objectInfo!,
1443+
);
1444+
const diagFilterd = diag.filter(
1445+
(d) => d.code === SepticDiagnosticCode.duplicate,
1446+
);
1447+
expect(diagFilterd.length).to.equal(0);
1448+
});
14301449
});
14311450

14321451
describe("Test validation of object structure", () => {

0 commit comments

Comments
 (0)