Can I have multiple languages running in the same LS? #976
-
Is it possible to have two different languages running in the same LS Worker in the browser? Or do I have to create multiple workers? Is it just a matter of registering two language modules in the same shared module? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @luiz290788, we do have an example for multiple languages in one language server over at the requirements example. Langium doesn't really care whether you're running in a node or browser/webworker context, so that should work as expected. Note that once you add more than one language to a shared module, the input files need to have the correct file extension to pick the respective language service instance. With just one language, the shared service instance will always return the singleton, independent of the file extension. |
Beta Was this translation helpful? Give feedback.
Hey @luiz290788,
we do have an example for multiple languages in one language server over at the requirements example. Langium doesn't really care whether you're running in a node or browser/webworker context, so that should work as expected.
Note that once you add more than one language to a shared module, the input files need to have the correct file extension to pick the respective language service instance. With just one language, the shared service instance will always return the singleton, independent of the file extension.