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

Add source URL to diagnostic about extra content in @Links directive #753

Merged
merged 4 commits into from
Dec 12, 2023

Conversation

d-ronnqvist
Copy link
Contributor

@d-ronnqvist d-ronnqvist commented Nov 17, 2023

Bug/issue #, if applicable: rdar://118478839

Summary

This fixes an issue where diagnostic about extra content in @Links directives didn't display on the line of that content because the diagnostic didn't have a source URL.

Dependencies

None

Testing

  • In any project with either articles or documentation extension files, add an @Links directive with some extra content after one of the links, for example:
@Links(visualStyle: compactGrid) {
    - ``SomeSymbol`` Some extra content after the link
}
  • Build documentation for that project. The "Extraneous content found after a link" warning should display the file and line that's causing the warning.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • [ ] Updated documentation if necessary

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@patshaughnessy patshaughnessy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI Chris Sanders just saw this in production and filed a new Radar for it.

@@ -238,3 +240,8 @@ extension TaskGroup {
}
}

private extension SourceRange {
var source: URL? {
lowerBound.source ?? upperBound.source
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, is there a case where lowerBound.source may not exist but upperBound.source would exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory it's possible but I don't think there's a real case where it would happen.. I believe in practice either one or both of the source locations would have a source.

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit 7b72288 into apple:main Dec 12, 2023
2 checks passed
@d-ronnqvist d-ronnqvist deleted the links-content-warning-source branch February 19, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants