Skip to content

Comparison of ScopeProvider logic in Xtext and Langium #1569

Answered by msujew
movalz asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @movalz, sorry for the late response, it seems like the notification for this fell through the cracks.

Is this correct? Is it planned to implement a similar approach in the future?

I believe the polymorphicFindScopeForReferenceName and polymorphicFindScopeForClassName methods were always pretty hacky. Since we aim to keep the framework as lean as possible, we went with the simplest design for the ScopeProvider available. Note that you can easily reimplement that behavior yourself in TypeScript:

getScope(context: ReferenceInfo): Scope {
  const referenceName = `scope_${context.container.$type}_${context.property}`;
  if (referenceName in this) {
    return this[referenceName](context);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by movalz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants