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

Fix snippets in Scala 3 documentation #12967

Open
pikinier20 opened this issue Jun 28, 2021 · 4 comments
Open

Fix snippets in Scala 3 documentation #12967

pikinier20 opened this issue Jun 28, 2021 · 4 comments

Comments

@pikinier20
Copy link
Contributor

pikinier20 commented Jun 28, 2021

Summary

<style type="text/css"></style>

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)
  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 = ???
//}
  1. Create PR to master.
@pikinier20
Copy link
Contributor Author

I take three last parts

@pikinier20
Copy link
Contributor Author

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

@KacperFKorban
Copy link
Member

KacperFKorban commented Sep 15, 2021

Checklist:

i10416 added a commit to i10416/dotty that referenced this issue Jan 20, 2024
- Fix build settings to make the snippet compiler to work properly
- Tweak some doc snippets so that they pass snippet compiker check

Related to: scala#12967
i10416 added a commit to i10416/dotty that referenced this issue Jan 20, 2024
- Fix build settings to make the snippet compiler to work properly
- Tweak some doc snippets so that they pass snippet compiker check

Related to: scala#12967
@i10416
Copy link
Contributor

i10416 commented Jan 20, 2024

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

i10416 added a commit to i10416/dotty that referenced this issue Jan 22, 2024
This commit addresses a part of scala#12967.

To make documents pass snippet checking, I modified some Scala code blocks while keeping original code as much as possible.

Snippet check for docs raises "dotty.tools.dotc.MissingCoreLibraryException: Could not find package scala from compiler core libraries." on CI(not on my local machine),
so I skip adding docs to Build.scala for now.
sjrd added a commit that referenced this issue Jan 23, 2024
- Fix build settings to make the snippet compiler to work properly
- Before this change, snippet compiler read from `library/scala` instead
of `library/src/scala`
- Tweak some doc snippets so that they pass snippet compiker check

Related to: #12967
WojciechMazur added a commit that referenced this issue Jun 27, 2024
- Fix build settings to make the snippet compiler to work properly
- Tweak some doc snippets so that they pass snippet compiker check

Related to: #12967

[Cherry-picked 438a17a][modified]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants