-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Scaladoc: Allow to set a comment syntax based on path to source #14650
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
Scaladoc: Allow to set a comment syntax based on path to source #14650
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not introduce additional setting. Instead of this, we can change the old -comment-syntax
setting to accept list of options. PathBased handles option without path as a fallback so it will work right away.
cc89009
to
f481fbe
Compare
f481fbe
to
d0290ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also set correct syntaxes to dotty library and scala 2.13 library in Build.scala?
CommentSyntax.CommentSyntaxParser.parse(commentSetting).getOrElse { | ||
val msg = s"not a valid comment syntax: $commentSetting, defaulting to Markdown syntax." | ||
// we should update pos with span from documentation | ||
pos.fold(report.warning(msg))(report.warning(msg, _)) | ||
|
||
CommentSyntax.default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we here fall back to the syntax based on path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overally, this is a great work.
I've left only one place that would eventually need a change. Besides that LGTM.
d0290ee
to
196f207
Compare
CommentSyntax option now allows to set the comment syntax based on a passed path prefix. This will allow to use a correct syntax for specific files in one project, for example a wiki syntax for scalalib and md syntax for dottylib.
Those consist of packages example.comment.md and example.comment.wiki configured with a matching comment syntax.
Wiki syntax was set for scala 2.13 stdlib and markdown was set for scala 3 stdlib.
196f207
to
8766c44
Compare
This PR adds a new Scaladoc option: CommentSyntaxOverrides, which allows to override the project wide comment syntax with one set based on a path prefix to a source file.This PR revises
-comment-syntax
option to use the PathBased abstraction. This will allow to use multiple syntaxes in one project. The previous style of option passing (one syntax format for the whole project) will still work.Additionally in the dotty repo the following paths were set with this option:
scaladoc-testcases
examples showcasing the feature (in theexamples.comment.markdown
andexamples.comment.wiki
packages)Resolves #14596