-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Search for name in range of lines and add flexible sourcelinks #12819
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
Conversation
41f0805
to
827b301
Compare
827b301
to
1f7f355
Compare
The problem was caused by stripping extension incorrectly from files
Doc generated using this PR - latest blogpost links correctly |
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.
Changes seem OK, though I have few questions.
@@ -9,7 +9,7 @@ <h1>{{ page.title }}</h1> | |||
{% for post in site.posts %} | |||
<li> | |||
<h2> | |||
<a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a> | |||
<a href="{{ post.url }}">{{ post.title }}</a> |
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.
Was site.baseurl
empty string?
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.
yes, we do not expose such setting
@@ -1244,7 +1244,12 @@ object Build { | |||
// TODO add versions etc. | |||
def srcManaged(v: String, s: String) = s"out/bootstrap/stdlib-bootstrapped/scala-$v/src_managed/main/$s-library-src" | |||
def scalaSrcLink(v: String, s: String) = s"-source-links:$s=github://scala/scala/v$v#src/library" | |||
def dottySrcLink(v: String, s: String) = s"-source-links:$s=github://lampepfl/dotty/$v#library/src" | |||
def dottySrcLink(v: String, s: String) = | |||
sys.env.get("GITHUB_SHA") match { |
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.
Why do we need this environment variables
driven logic?
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.
The problem is that we want to link to the source code that has been actually used for this PR, not the 3.0.0 sources. Before we tried to link to e.g. experimental.scala that that not exists in 3.0.0
val memberToMatch = member.replace("`", "") | ||
assertTrue(s"Expected to find $memberToMatch at $link at line $line", loc.contains(memberToMatch)) | ||
val lineCorrectlyDefined = (expectedLine.toInt until toLine.toInt).exists{ line => |
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.
If I understand it correctly we look for the member in the range of lines. Was there something failing for the exact line match?
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.
yes, in was the case of name that spans in multiple lines like asMatchable
: https://github.com/lampepfl/dotty/blob/3.0.0/library/src/scala/compiletime/package.scala#L169-L170
fixes #12762
fixes problems with sourcelink tests