scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.88k stars 1.06k forks source link

Fix snippets in Scala 3 documentation #12967

Open pikinier20 opened 3 years ago

pikinier20 commented 3 years ago

Summary

Location | Count -- | -- scala.quoted | 26 scala.compiletime | 6 scala | 1 blog/_posts | 28 docs/contributing | 5 docs/internals | 9 docs/reference/changed-features | 19 docs/reference/contextual | 16 docs/reference/dropped-features | 11 docs/reference/enums | 3 docs/reference/experimental | 3 docs/reference/metaprogramming | 7 docs/reference/new-types | 9 docs/reference/other-new-features | 20 docs/usage | 4 docs/release-notes | 1 # Instruction 1. Find `generateScalaDocumentation` task in `Build.scala` 2. Find `generateDocumentation` call inside task definition 3. Add the part of documentation that you want to fix to snippet compiler setting (You can find usage [here](https://github.com/lampepfl/dotty/blob/master/scaladoc/src/dotty/tools/scaladoc/snippets/SnippetCompilerArgs.scala#L32)) 4. Path to scala3 library is stored in `dottyLibRoot` variable 5. E.g. if you want to run snippet compiler on `scala.quoted`, add `$dottyLibRoot/scala/quoted=compile` 6. If you want to run snippet compiler on `docs/contributing`, add `docs/docs/contributing=compile` 7. Fix all failing snippets or override snippet compiler flag if it's necessary. 8. You can override flag by adding `sc:flag` after "```scala" in snippet. 9. You can hide piece of code by doing: ``` //{ def someHiddenCode = ??? //} ``` 10. Create PR to master.
pikinier20 commented 3 years ago

I take three last parts

pikinier20 commented 3 years ago

Fixing snippets in static site is currently suspended because of docs migration

KacperFKorban commented 3 years ago

Checklist:

i10416 commented 9 months ago

For someone interested in this issue, see the following guide to find advanced usages like sc-name and sc-compile-with. https://docs.scala-lang.org/scala3/guides/scaladoc/snippet-compiler.html