Configure single Language Server with multiple grammars (IResourceServiceProvider) [message #1799936] |
Mon, 17 December 2018 11:51  |
Eclipse User |
|
|
|
Hi,
we are working on migrating an existing Xtext project from an Eclipse application to a Language Server solution.
The project has multiple grammars/languages in separate sub-projects. Currently only the language(s) of one sub-project are integrated with the language server.
How can we integrate multiple languages from different subprojects into the Language Server so their ISetup is loaded?
Details
Existing setup (based on "New Project Wizard" and existing code base):
- org.example.mylang
- MyLangA.xtext
- MyLangB.xtext
- GenerateMyLang.mwe2
- generates infrastructure for MyLangA.xtext and MyLangB.xtext.
Uses standard XtextGenerator as created by the wizard with 2 custom language = XtextGeneratorLanguage for MyLangA and MyLangB
- genericIde generates META-INF/services/org.eclipse.xtext.ISetup file with MyLangAIdeSetup and MyLangBIdeSetup in org.example.mylang.ide
- StandaloneSetup bean does registerGenModelFile and registerGeneratedEPackage for platform:/resource/org.example.other/model/generated/Other.genmodel
- org.example.mylang.ide
- Gradle mainClassName = "org.eclipse.xtext.ide.server.ServerLauncher"
- org.example.other
- Other.xtext
- GenerateOther.mwe2
- generates infrastructure for Other.xtext
- No genericIde / org.example.other.ide
The org.eclipse.xtext.ISetup implementations for the org.example.mylang languages (MyLangA/BIdeSetup) are loaded by the ResourceServiceProviderServiceLoader so the correct IResourceServiceProviders are registered for their file extensions (e.g. langa and langb).
The generated OtherStandaloneSetupGenerated implementation registers to the IResourceServiceProvider.Registry.INSTANCE which is different from the IResourceServiceProvider.Registry created by ResourceServiceProviderServiceLoader, so the Other language is not recognized by the language server.
What would be the recommended Xtext MWE2 workflow and project configuration/layout so that:
- META-INF/services/org.eclipse.xtext.ISetup is generated containing the service providers for all languages (MyLangA, MyLangB, Other)
- the ResourceServiceProviderServiceLoader of a single Language Server loads these ISetup implementations for all languages (MyLangA, MyLangB, Other)
Thanks for your help, cheers
Goan
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05093 seconds