Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot add package description in ScalaDoc (Scala 3)

I cannot add a package description in ScalaDoc with Scala 3

/** package description */
package foo {
    /** some scaladoc comment */
    def method():A = ???
}

Then I generate the doc with sbt (1.5.3)

sbt> doc

I don't get the description of the package itself in the index.html file, but only the description of the method inside the package.

like image 929
lepaincestbon Avatar asked Jun 13 '21 11:06

lepaincestbon


People also ask

What is a Scala package?

Package in Scala is a mechanism to encapsulate a group of classes, sub packages, traits and package objects. It basically provides namespace to put our code in a different files and directories. Packages is a easy way to maintain our code which prevents naming conflicts of members of different packages.

What is scaladoc in Scala?

Scaladoc is a documentation generation system that reads specially formatted comments in Scala source code and generates compiled documentation. It is similar to Javadoc in Java. In this tutorial, we’ll learn how to add Scaladoc to code for a Scala project.

How do I mark up my source code using scaladoc?

You can mark up your source code using Scaladoc tags as well as a wiki-like syntax. The following code shows many of the Scaladoc tags and a few of the wiki-style markup tags: package co.kbhr.scaladoc_tags /** * A class to represent a ''human being''.

How to import multiple members of a package in Scala?

In Scala you can import one member from a package like this: and multiple members like this: When importing multiple members, you can import them more concisely like this: When you want to import everything from the scala.concurrent package, use this syntax: import scala.concurrent.*


Video Answer


1 Answers

I finally found the answer

Scaladoc comments can go before fields, methods, classes, traits, objects. For now, scaladoc doesn't support straightforward solution to document packages. There is a dedicated github issue, where you can check the current status of the problem.

https://github.com/lampepfl/dotty/issues/11284

like image 91
lepaincestbon Avatar answered Oct 24 '22 00:10

lepaincestbon