-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
starlark: dedent continued function param lines #12286
Conversation
This allows multi-line parameter documentation under Args: without extra indents. Fixes bazelbuild/stardoc#74
ping @c-parsons are you the right person to merge? |
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 modify pure_markdown_test
as well to demonstrate how this change affects markdown tables?
break; | ||
} | ||
String trimmedLine = line.substring(baselineIndentation); | ||
if (lineIndentation < continuationIndentation) { |
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.
We're not truly finding the minimum indentation value here, as we're still processing as we go.
Consider the difference in behavior for:
Line one
Line two
Line three
versus
Line one
Line two
Line three
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.
correct, but the failure mode is that you get some extra whitespace if the continuation is accidentally not consistent. For your example I think
Line one
Line two
Line three
and
Line one
Line two
Line three
are the best outcome we'll get without scanning ahead for the minimal indent. Do you think it's worth adding the complexity to scan ahead?
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, I don't think it's much more complex to scan ahead (we're not dealing with gigantic strings here, so it should be fine to store all the lines in a list, take the min indent, and then iterate over)
I foresee later user confusion / frustration with the current behavior, if we don't fix this right the first time.
Thanks!
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.
Okay, done PTAL
Added the change to |
FYI @alandonovan |
ping @c-parsons mergey merge-merge? |
Merge in review. Thanks for your patience. |
This allows multi-line parameter documentation under Args: without extra indents.
Fixes bazelbuild/stardoc#74