Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing reference warning for UAAppl #611

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions public/objects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@
refs:
attributes: [CvrIds, MvrDvrIds]
- name: ModelPlot
- name: MPCAppl
level: 1
symbolKind: Namespace
- name: MsgBox
- name: MultiXvrPlot
refs:
Expand Down
29 changes: 29 additions & 0 deletions server/src/language-service/diagnosticsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,10 @@ export function validateObjectReferences(
diagnostics.push(
...validateCalcPvrIdentifierReferences(obj, refProvider, doc)
);
} else if (obj.isType("UAAppl")) {
diagnostics.push(
...validateUAApplReferences(obj, refProvider, doc)
);
} else {
diagnostics.push(
...validateIdentifierReferences(
Expand Down Expand Up @@ -910,6 +914,31 @@ function validateCalcPvrIdentifierReferences(
];
}

function validateUAApplReferences(
obj: SepticObject,
refProvider: SepticReferenceProvider,
doc: ITextDocument
): Diagnostic[] {
for (const object of refProvider.getObjectsByIdentifier(
obj.identifier!.name
)) {
if (object.isType("SmpcAppl", "MPCAppl")) {
return [];
}
}
return [
createDiagnostic(
DiagnosticSeverity.Warning,
{
start: doc.positionAt(obj.identifier!.start),
end: doc.positionAt(obj.identifier!.end),
},
"Missing reference to SmpcAppl or MPCAppl",
DiagnosticCode.missingReference
),
];
}

const hasReferenceToEvr: RefValidationFunction = (refs: SepticReference[]) => {
for (const ref of refs) {
if (ref.obj?.isType("Evr")) {
Expand Down
Loading