diff --git a/server/src/parser/parser.ts b/server/src/parser/parser.ts index 4ece2708..eeaa5ffc 100644 --- a/server/src/parser/parser.ts +++ b/server/src/parser/parser.ts @@ -498,8 +498,9 @@ export class ShortClass extends Element { super(); const specifier = (definition.class_definition ?? definition) .class_specifier.short_class_specifier; + const specifierType = typeStore.get(specifier.value?.name, basePath); this.name = specifier.identifier; - this.value = specifier?.value?.name; + this.value = specifierType?.modelicaPath || specifier.value?.name; this.modelicaPath = `${basePath}.${this.name}`; this.type = this.modelicaPath; const registered = this.registerPath(this.modelicaPath, this.type); diff --git a/server/tests/integration/parser/template.test.ts b/server/tests/integration/parser/template.test.ts index 04b093da..eaacb686 100644 --- a/server/tests/integration/parser/template.test.ts +++ b/server/tests/integration/parser/template.test.ts @@ -5,7 +5,6 @@ import { Template, getOptions, } from "../../../src/parser/"; -import fs from "fs"; import { getTemplates, getProject } from "../../../src/parser/template"; const TEMPLATE_PATH = "TestPackage.Template.TestTemplate"; @@ -220,7 +219,7 @@ describe("'Project' items are extracted", () => { }); }); - it("Replaceable short class definitions ***using full class names*** are supported", () => { + it("Replaceable short class definitions are supported", () => { const templates = getTemplates(); const template = templates.find( (t) => t.modelicaPath === TEMPLATE_PATH, diff --git a/server/tests/static-data/TestPackage/Template/TestTemplate.mo b/server/tests/static-data/TestPackage/Template/TestTemplate.mo index 9c1d55b5..057b87c0 100644 --- a/server/tests/static-data/TestPackage/Template/TestTemplate.mo +++ b/server/tests/static-data/TestPackage/Template/TestTemplate.mo @@ -166,9 +166,8 @@ model TestTemplate "Test Template" Dialog(group="Selectable Component")); // Test short class definition - // Currently only full class names are supported for short class assignments replaceable model ShortClass = - TestPackage.Component.FirstComponent + Component.FirstComponent constrainedby TestPackage.Interface.PartialComponent "Replaceable short class" annotation(choices(