LangiumDocuments and WorkspaceManager #537
Replies: 2 comments
-
You'll need to create a subclass of |
Beta Was this translation helpful? Give feedback.
-
I ended up with a slightly different solution. Instead of two grammars, I combined them into one and adjusted my entry rule to look like this:
I modified the
I then wrote a custom
This seems to do the trick. I think I generally understand the approach that you recommend as well, so thank you for the quick reply! |
Beta Was this translation helpful? Give feedback.
-
Based on the changes in #377, my understanding is that, starting with 0.3.0, any document that is included in a workspace is automatically indexed by the WorkspaceManager. I want to make sure that I understand how this is intended to be used, so please comment at your leisure on whether I am using it as designed.
I intend to configure my language project to have a second grammar/language that imports the first:
langium-config.json
Next, I have configured my language server project to export a
resources/
folder that includes the file that serves as the source for items in the global scope:/resources/global.behaviors
Next, I have created a task in
package.json
to copy the/resources/global.behaviors
file to the output directory.Lastly, I am relying on the behavior of the default
WorkspaceManager
to index this file so that it is included in the LangiumDocument collection for the workspace.If this sounds OK so far, here is my question:
How do I add the parsed contents of the
global.behaviors
file to the global scope? Do I need to add a custom ScopeProvider that does this, or is there already a mechanism in place in Langium to be able to use an external resource like this to resolve cross references? In other words, are the parsed contents of the external resource document a pre-computed scope?Beta Was this translation helpful? Give feedback.
All reactions