-
I come from Xtext (we have some big DSLs defined in Xtext) and investigate switching to Langium. I am not yet an expert in TypeScript, Node.js and VSCode. One important point is "ScopeProvider" logic. As far as I have understood, the default logic for ScopeProvider differs in following points:
The logic for determination of the local scope in Xtext and Langium seems to be identical (as described in DefaultScopeComputation.ts), am I right? (thank you for inline doc, that's missing in Xtext) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
No response? It would be nice to get an answer for my questions. |
Beta Was this translation helpful? Give feedback.
-
Hey @movalz, sorry for the late response, it seems like the notification for this fell through the cracks.
I believe the getScope(context: ReferenceInfo): Scope {
const referenceName = `scope_${context.container.$type}_${context.property}`;
if (referenceName in this) {
return this[referenceName](context);
} else {
return super.getScope(context);
}
}
You can add arbitrary directories to the workspace, see also the WorkspaceManager implementation. You can also add documents individually by using the
Yes, even though the implementation differs a bit (Langium uses a less resource intensive method to determine local scopes) the result should generally be the same. |
Beta Was this translation helpful? Give feedback.
Hey @movalz, sorry for the late response, it seems like the notification for this fell through the cracks.
I believe the
polymorphicFindScopeForReferenceName
andpolymorphicFindScopeForClassName
methods were always pretty hacky. Since we aim to keep the framework as lean as possible, we went with the simplest design for theScopeProvider
available. Note that you can easily reimplement that behavior yourself in TypeScript: