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: diagnostics for unknown objects #352

Merged
merged 1 commit into from
Oct 20, 2023
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
5 changes: 5 additions & 0 deletions public/objects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@
identifier: True
- name: Spacer
- name: SubrXvr
- name: Svr
level: 2
symbolKind: Variable
refs:
identifier: True
- name: System
level: 1
symbolKind: Namespace
Expand Down
9 changes: 6 additions & 3 deletions server/src/language-service/diagnosticsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ export function validateObjects(
for (let obj of cnfg.objects) {
const objectDoc = metaInfoProvider.getObjectDocumentation(obj.type);
const objectInfo = metaInfoProvider.getObject(obj.type);
if (!objectDoc || !objectInfo) {
if (!objectDoc) {
diagnostics.push(
createDiagnostic(
DiagnosticSeverity.Error,
Expand All @@ -572,7 +572,7 @@ export function validateObject(
doc: ITextDocument,
refProvider: SepticReferenceProvider,
objectDoc: ISepticObjectDocumentation,
objectInfo: SepticObjectInfo
objectInfo: SepticObjectInfo | undefined
): Diagnostic[] {
const diagnostics: Diagnostic[] = [];
diagnostics.push(...validateObjectParent(obj, doc));
Expand Down Expand Up @@ -626,8 +626,11 @@ export function validateObjectReferences(
obj: SepticObject,
doc: ITextDocument,
refProvider: SepticReferenceProvider,
objectMetaInfo: SepticObjectInfo
objectMetaInfo: SepticObjectInfo | undefined
): Diagnostic[] {
if (!objectMetaInfo) {
return [];
}
const diagnostics: Diagnostic[] = [];
if (objectMetaInfo.refs.identifier && obj.identifier && !obj.isXvr()) {
let validRef = refProvider.validateRef(
Expand Down
Loading