diff --git a/public/objects.yaml b/public/objects.yaml index 18701282..cca85fd7 100644 --- a/public/objects.yaml +++ b/public/objects.yaml @@ -100,6 +100,9 @@ refs: attributes: [CvrIds, MvrDvrIds] - name: ModelPlot +- name: MPCAppl + level: 1 + symbolKind: Namespace - name: MsgBox - name: MultiXvrPlot refs: diff --git a/server/src/language-service/diagnosticsProvider.ts b/server/src/language-service/diagnosticsProvider.ts index b93a1bb7..0fe6f387 100644 --- a/server/src/language-service/diagnosticsProvider.ts +++ b/server/src/language-service/diagnosticsProvider.ts @@ -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( @@ -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")) {