Skip to content

Simplify to register additional/custom Typir services - #78

Merged
JohannesMeierSE merged 16 commits into
mainfrom
jm/added-services
Aug 1, 2025
Merged

Simplify to register additional/custom Typir services#78
JohannesMeierSE merged 16 commits into
mainfrom
jm/added-services

Conversation

@JohannesMeierSE

Copy link
Copy Markdown
Collaborator

This PR adds additional APIs to register custom/additional services for Typir core and Typir-Langium, which are application-specific.

@JohannesMeierSE

Copy link
Copy Markdown
Collaborator Author

@insafuhrmann I just pushed updates for this PR in order to demonstrate this PR for custom types. Additionally I wrote some more documentation.

@insafuhrmann insafuhrmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread packages/typir/test/customization-example.test.ts
Comment thread packages/typir/test/customization-example.test.ts Outdated
Comment thread packages/typir/test/customization-example.test.ts Outdated
Comment thread packages/typir/src/initialization/type-initializer.ts Outdated
Comment thread packages/typir/src/typir.ts Outdated
Comment thread packages/typir/src/typir.ts Outdated
Comment thread packages/typir-langium/src/typir-langium.ts Outdated
Comment thread packages/typir-langium/src/features/langium-caching.ts
Comment thread documentation/customization.md Outdated
Comment thread packages/typir/src/typir.ts Outdated
);
}

// TODO Review: Is it possible to merge/unify the two functions above in a nice way?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about this question. Could we discuss this?

@JohannesMeierSE JohannesMeierSE left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>>,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ...

Comment thread packages/typir-langium/src/features/langium-caching.ts
Comment thread packages/typir/test/customization-example.test.ts Outdated
Comment thread packages/typir/src/initialization/type-initializer.ts Outdated
Comment thread packages/typir/test/customization-example.test.ts Outdated

@insafuhrmann insafuhrmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the adjustments @JohannesMeierSE! Looks nice to me!

@JohannesMeierSE
JohannesMeierSE merged commit 86c9fda into main Aug 1, 2025
2 checks passed
@JohannesMeierSE
JohannesMeierSE deleted the jm/added-services branch August 1, 2025 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants