eclipse-langium / langium

Next-gen language engineering / DSL framework
https://langium.org/
MIT License
665 stars 61 forks source link

Export grammar-related generators from CLI #1434

Closed Lotes closed 2 months ago

Lotes commented 3 months ago

For the Langium playground I need to import the Textmate generator. Therefore I am exporting a couple of generators from the CLI. My current alternative is to copy the code from this repo, which is actually not that nice.

Speak up if you want a different export strategy. Currently I am exporting each generator in its own export alias.


This PR adds a new ESM export /textmate to the langium-cli package. It contains the highlighting generator for Textmate syntax highlighters (Monaco editor).

dhuebner commented 3 months ago

@Lotes In general I think it is good to export useful components to users. One thing to keep in mind, when exporting code we make it a public API, hence need to care that we do not break it in the future and we should document it. If you just need the textmate generator, maybe we should first only export just this generator, WDYT?

Lotes commented 3 months ago

@dhuebner Thanks for the argument. That is a very valid point. Then I will only export the Textmate generator. But even there I am unsure: Shall I export it under "/textmate" or better under something more general like "/syntax-highlighting"...? Maybe start with something specific and deprecate when the time has come and it becomes more general?

montymxb commented 3 months ago

I agree with @dhuebner here. Exporting just what we need makes sense for now. And as for the name, textmate seems fine, but we should document that new endpoint to make it clear what it provide (later on, before the next release).

Lotes commented 3 months ago

@montymxb As far as I can see there is no next change log file or something similar. So I will document the endpoint in the main description of this PR. @msujew I have done the split. Nice catch. Please have another look.

Lotes commented 2 months ago

I need to wait for #1437 since I want to increment the Langium CLI version and trigger Langium generator for the examples.