Skip to content
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

Documenting Scala 2/3 approaches #835

Open
adamnfish opened this issue Jan 26, 2024 · 1 comment
Open

Documenting Scala 2/3 approaches #835

adamnfish opened this issue Jan 26, 2024 · 1 comment

Comments

@adamnfish
Copy link

For libraries that use advanced Scala features (most commonly typeclass derivation) the approach is likely to differ for users on Scala 2.x / vs 3.x. Documenting both approaches is important while both Scala versions are supported, which is likely to be the case for some time.

Is this possible now? I haven't been able to find any settings that would allow code blocks to use different compilers, and indeed mdoc's "program semantics" approach implies this might be a non-goal.

If it isn't possible, perhaps others have examples or recommendations for how best to address this Scala 2/3 split?

Thank you!

@tgodzik
Copy link
Contributor

tgodzik commented Jan 28, 2024

Thanks for raising this! I think that looks like a really needed feature, but currently this is not possible. However, while not easy by all means, It should probably be possible to add a custom tag that would manually invoke mdoc as a library with two different Scala versions. Like in https://scalameta.org/mdoc/docs/modifiers.html#stringmodifier

You could take a look at how Metals does it for worksheets in https://github.com/scalameta/metals/blob/46957a94f1f3ad57990ea7f7b09bf6ff8f38ae9a/metals/src/main/scala/scala/meta/internal/worksheets/WorksheetProvider.scala#L405

Though the API might be less than ideal for you here. It would probably be great to have that implemented internally in Mdoc, but unfortunately this is not in the plans currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants