-
Notifications
You must be signed in to change notification settings - Fork 146
Prefer non-symbols in general documentation links #594
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
Merged
d-ronnqvist
merged 3 commits into
swiftlang:main
from
d-ronnqvist:prefer-non-symbols-in-doc-links
May 25, 2023
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm struggling to follow this line. Could it be structured like this or is it doing something different?
Have these not already been filtered out prior to this or do we need to handle that case here?
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 only difference is that with
onlyFindSymbols
inside the closure it checks both ways.For symbol links (when
onlyFindSymbols
istrue
) it checks that the match has a symbol.For general documentation links (when
onlyFindSymbols
isfalse
) it checks that the match doesn't have a symbol.It is checked at the start of the search to avoid looking at the article root but as I was writing this I thought that it would be possible to find an article as a child of the module. Now I'm not sure anymore.. I'll have to try it.
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 sounds good. If it's possible to simplify this I think that would make it easier to follow – but not a blocker.
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 tested this and in the case where a symbol and an article have the same path, a link that's spelled with the absolute path will have a collisions here. In this case filtering out non-symbols in symbol links in both places (here and where the found node is returned) provides a better experience because it avoids the collisions (and also excludes the non-symbols from diagnostics if there were multiple symbols colliding with an article).
I updated the comment to explain all this, added a test that has this behavior, and added an extra comment that explains that check is a more compact spelling of two comparisons and an if statement.