Simplify to register additional/custom Typir services - #78
Conversation
…mes needs to check that the kind of the types is the same (a test case will follow)
…hAdditionalServices`
…ervicesWithAdditionalServices`
…ype/factory example
7fe777f to
004e546
Compare
004e546 to
ab78f9d
Compare
|
@insafuhrmann I just pushed updates for this PR in order to demonstrate this PR for custom types. Additionally I wrote some more documentation. |
insafuhrmann
left a comment
There was a problem hiding this comment.
Thanks @JohannesMeierSE, I think this is a fine contribution, I have some detail remarks and was not sure about a question you asked, so maybe we can discuss this shortly?
| ); | ||
| } | ||
|
|
||
| // TODO Review: Is it possible to merge/unify the two functions above in a nice way? |
There was a problem hiding this comment.
I am not sure about this question. Could we discuss this?
JohannesMeierSE
left a comment
There was a problem hiding this comment.
Thanks @insafuhrmann for your review! Yes, lets discuss the open questions in our joint meeting.
| customization3: Module<TypirServices<LanguageType>, PartialTypirServices<LanguageType>> = {}, | ||
| customization1?: Module<TypirServices<LanguageType>, PartialTypirServices<LanguageType>>, | ||
| customization2?: Module<TypirServices<LanguageType>, PartialTypirServices<LanguageType>>, | ||
| customization3?: Module<TypirServices<LanguageType>, PartialTypirServices<LanguageType>>, |
There was a problem hiding this comment.
Yes, in the end, three is an arbitrary number here. I am fine to add even more optional customizations. For me, it sounds like a good idea to some more in order to make it even more flexible. inject in dependency-injection.ts from Langium has even 8 optional customizations ...
insafuhrmann
left a comment
There was a problem hiding this comment.
Thank you very much for the adjustments @JohannesMeierSE! Looks nice to me!
This PR adds additional APIs to register custom/additional services for Typir core and Typir-Langium, which are application-specific.
as Module<PartialTypirLangiumServices<ELangAstType>>reported in What would be the best way to extend the Kind factory in Typir Langium? #77.packages/typir/test/customization-example.test.tsfor some examples.