Replies: 1 comment 1 reply
-
Hey @snarkipus, I haven't looked to deep into your language repo, but instead provided a small example with the type-system branch of the langium-lox project, for which I've just added class based scoping. Please check it out and take a look at it. I believe my code speaks louder and more clearly than any of my verbose explanations are able to. Also, note the following:
Note that there's still some stuff missing in the branch, notably constructors and function overriding, among other minor issues. I'll try to add those soon, but I'm quite busy this month between vacation (which just ended), the flu, and preparations for multiple presentations such as meetups and EclipseCon 2022. Afterwards I'll probably have some more time, which I plan to dedicate on some more Langium documentation, especially regarding scoping. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Tags: @msujew
Alright, I'm giving in and asking/pleading for help since after several weeks of banging my head against it, I think there's something I'm fundamentally missing (more likely a flaw in my understanding). Unless requested otherwise, I'll just post links to code rather than giant code blocks out of context.
I'm about halfway done with the final section of this reference on Xtext scoping and it has proven to be incredibly difficult for me to work through. Thus far, most of Langium loosely follows the basic Xtext way of doing things. Obviously, the default scoping implementation is quite different with the onus placed on the dev to tailor it to their needs.
Question 1: Default Scoping Testing
To me, the Xtext
IScope getScope(EObject context, EReference Reference)
method is a very 'reference-type'-centric view of the scoping situation. From that perspective, I eventually thought that determining scopes would be quite similar to resolving completions so I took inspiration from that.Question 2: Scope Computation Customization
The DomainModel DSL example implementation is easy enough to follow by virtue of the fact that 'Packages' and the 'Domain Model' are all comprised of commonly named elements thereby making it somewhat trivial to iterate through. This example language is admittedly more complex with more flexibility in nesting. Unfortunately, the Xtext method (which relies on niceties like
takeWhile
) is quite different from the DomainModel solution so I've hit a brick wall on this. I'm stuck in the middle of extending the Default Scope Computation class and need a fresh set of eyes if possible.Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions