Wrong linking / references #1749
-
Creating a language with the small grammar below results in the following unexpected behaviour: The references in line Stage: Are not actually navigable references in the generated VSCode editor
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey @grafandreas, I've converted this issue into a discussion, as you're not encountering a bug.
So it's a navigatable reference, but it doesn't navigate? That sounds like an oxymoron :D Anyway, first off there's a major issue (and the latest versions of Langium should warn you about that) in your entry rule. Parsing multiple Then there's the issue of linking: Langium doesn't magically know how all references are supposed to be linked. Instead, it features a relatively simplistic default mechanism (local scopes) that can be customized/extended to support your language. See our scoping guide. |
Beta Was this translation helpful? Give feedback.
-
@msujew It is a navigable reference in the grammar, but it is not reflected in the editor. Maybe I am to Xtext influenced, I was assuming that the default scoping picks up matching elements in a file (as local scope)? |
Beta Was this translation helpful? Give feedback.
Langium's default scoping uses local scopes as well. However, as
Microaction
instances are defined in the scope of aMicroaction_def
, it won't be available outside of that. That is the definition of a local scope. By default, elements are only available if they are a sibling, a parent, or a sibling of a parent (recursively). To adjust how the scoping is done, see the scoping guide posted above.