-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LSP] Xtext Grammar loaded twice when another Xtext grammar depends on it #2536
Comments
i think we need a special standalone setup that can handle this and creates injectors only once / does only metamodel registrations for parent grammar and not injector creation as well |
I had the same problem and solved it by making the injector returned by the |
@soerendomroes could you document your workaround here |
it also looks like the order in
plays a role too.
@szarnekow any ideas/hints on this? (wont solve the problem if dsl are separate though) |
@cdietrich I do the following:
A simple singleton is not enough. It can happen that some other bundle calls do setup first, but does not bind MyLangIdeModule. Therefore, I have a singleton that I can override if it some other bundle already created a wrong injector. |
Stumbled upon this as well. It seems bogus that My current workaround is to just override As I fix, I am inclined to change StandaloneSetupGenerated to
The combination of static methods and generated-once files makes it hard to find a non-breaking solution. An alternative would be to introduce an |
@JanKoehnlein wont we be able to add the new IF/Method to the abstract class? the IF even could delegate to the current method in a default impl |
@szarnekow what do you think? |
I assume we'll still need the injector of the base languages being created to make sure that validators for the EPackages are registered. It would probably help to extract a method |
if you use e.g. xbase the service loader will also call the registration for the baselanguage itself. |
is there anything that speaks against completely separating standalone and ide setups and let backwards compatibility be backwards compatibility? |
Since it's currently just very broken, I'd think backwards compatibility is not a reason to keep it as is. |
is there anything that speaks against making the injector instances static singletons? |
Testability comes to my mind, but usually the InjectorProvider for tests does the caching anyhow. |
When the house.xtext grammar is dependent on another grammar person.xtext the person grammar is loaded twice:
A consequence of this is that the Content Assist for the Person Grammar does not work.
Below a sample projects and reproduction steps:
The text was updated successfully, but these errors were encountered: