How to run generator after .vsix installation ? #855
-
Hi, I am relatively new to Langium and vscode extension, I am struggling with running the generator for code generation. I have packaged(.vsix) my project and installed in vscode. Everything else works except generator. I can able to generate code from Langium project using "node ./bin/cli generate xx.xxx", how can I generate the code after installing the extension ? I tried a bit to make use of "Command Palette", but its quite complicated and I don't have confidence if I am going the right way. Also in later point of time, I have to generate the code through command line without opening the vscode for CI/CD purpose. How can i achieve this ? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @open-domain, so Langium doesn't really provide a lot of guidance on how you can run the generator, given that there are a lot of different use cases how and when people want to generate their code. The CLI we offer by default is meant to be installed as a separate package, similar to how langium projects rely on the langium-cli package. Another way would be to have your generator run on every document change. You could hook your generator into the document lifecycle by calling You could also include the generator as a command. One way this could work is by registering a command on the language server side (using the
The best way to achieve this is probably the first option which I've outlined, i.e. creating a separate cli package for your language, which users can include in their |
Beta Was this translation helpful? Give feedback.
Hey @open-domain,
so Langium doesn't really provide a lot of guidance on how you can run the generator, given that there are a lot of different use cases how and when people want to generate their code. The CLI we offer by default is meant to be installed as a separate package, similar to how langium projects rely on the langium-cli package.
Another way would be to have your generator run on every document change. You could hook your generator into the document lifecycle by calling
onBuildPhase
. That would then run the generator on every changed document in the editor.You could also include the generator as a command. One way this could work is by registering a command on the language se…