-
Hi, I would like to propose a language that references ParserRules (or AbstractRules, to be defined later).
I guess this is because I'm not telling where is the langium grammar exactly ? I'm not sure if there exist a registry or something similar from which I could import the grammar. Additionally, once I will be able to do so, I would like in my language to import a specific Thanks in advance ! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 21 replies
-
Hey @jdeantoni, I'm a bit suprised by Langium spitting out an internal error for this (it should show a validation message instead). In theory you should be able to reference it by using something like Note that compared to Xtext, this effectively only copies the grammar rules and the interfaces/types and does not create actual relationships between the original objects of the language. You can of course still parse
In theory it should be loaded together as part of your language server initialization and then scoped to the import. We do it similarly in our own scope provider. |
Beta Was this translation helpful? Give feedback.
-
Thanks @msujew, that was very helpfull. Just a quick note, the link to be used is : With this import, I'm able to write down correctly my grammar. However, I was not able to correctly set up my scope provider by looking at yours. I'm able to retrieve the URI I want to load int the function but then some magic appeared in your scope provider since the elements seems to be already in the Thanks ! |
Beta Was this translation helpful? Give feedback.
Hey @jdeantoni,
I'm a bit suprised by Langium spitting out an internal error for this (it should show a validation message instead). In theory you should be able to reference it by using something like
import "../node_modules/langium/src/language-server/langium-grammar";
(with as many..
as needed for your directory structure). The language server might complain until you remove thenode_modules
from the ignore pattern of the langium vscode settings.Note that compared to Xtext, this effectively only copies the grammar rules and the interfaces/types and does not create actual relationships between the original objects of the language. You can of course still parse
.langium
files using you…