-
Hi,
and here a short example in this language:
My problem is that I get errors when I try to use the "login" and "proceed" definition of the "Case" in "Test". My assumption is that I have to override the DefaultScopeProvider because the reference of "test" in "Test" have to be present when the Editor tries to resolve the references of the "Testfunction". I tried to solve that overriding the ScopeProvicer in the Module of my DSL. In my ScopeProvider I tried this:
But I am not sure if this code is right and will do what it should. Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hey @Anthie123, the scope provider snippet that you provided isn't quite correct. The override getScope(context: ReferenceInfo): Scope {
if (context.property === 'tests' && isTestfunction(context.container)) {
const testFunction = context.container;
// The container of the `Testfunction` type should be a `Test` element
const testFunctionContainer = testFunction.$container as Test;
// Now we can find the referenced `Case` element
const testCase = testFunctionContainer.test.ref;
if (testCase) {
return this.createScopeForNodes(testCase.functions)
} else {
// Ensure that we don't return the default scope
return EMPTY_SCOPE;
}
}
return super.getScope(context)
} Note that you're not allowed to use The And yes, that is generally the way to write those domain specific scoping rules. We also have a few guides on that topic here if you haven't looked into those already. |
Beta Was this translation helpful? Give feedback.
Hey @Anthie123,
the scope provider snippet that you provided isn't quite correct. The
context.container
property contains the owner of the reference. Since thetests
reference is on theTestfunction
type, theisTest(context.container)
check will never return true. I haven't tested it, but something like this should work in that case: