Chetan Laddha
Chetan Laddha

Reputation: 1005

Single Xtext Language Server for two extensions

I have two Eclipse plugin Xtext(2.11) projects.(Called Project A and B) Project B grammar file is dependent on Project A grammar file. Project A's grammar file extension is a and Project B is b. I am able to generate the language server for Project B. I want to generate the single language server for both projects.(Currently, in project B it includes project A.) Depend on extension type it needs invoke respective Xtext grammar functionality.

In above scenario, I have below questions:

  1. Does Xtext can handle this kind of scenario seamlessly? Do I need to generate the language server for Project A also and need to add in Project B? What is the best way to do this?
  2. What kind of Xtext changes required?
  3. What kind of changes required at client side also? like in Visual code/ Che?

Upvotes: 0

Views: 343

Answers (1)

Anton Kosyakov
Anton Kosyakov

Reputation: 365

  1. Xtext LS can be used with multiple Xtext languages. It uses java service loading to look up language setups: https://github.com/eclipse/xtext-core/blob/master/org.eclipse.xtext/src/org/eclipse/xtext/resource/ResourceServiceProviderServiceLoader.xtend#L25. In ide project of your language you should be able to find META-INF/services/org.ecalipse.xtext.ISetup file that says java what implementations should be used for ISetup interface.
  2. Having jars for ide projects on the classpath should be enough. No changes are required.
  3. VS code and Che does not care about implementation details of Xtext LS, but both languages should be registered for them

Upvotes: 2

Related Questions