You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix#438 (Structure suggestions for link resolution warnings as fixits) (#455)
* fix#438 (Structure suggestions for link resolution warnings as fixits)
* address review feedback
- create TopicReferenceResolutionError with minimal public interface
- replace TopicReferenceResolutionResult.failure's errorMessage with TopicReferenceResolutionError
- add support for non-symbol reference syntax
- add Solution for PathHierarchy.Error.nonSymbolMatchForSymbolLink
- add meaningful information to Solution.summary
- scope Replacements as small as possible (on disambiguation, path segment, or reference delimiters)
- add note listing all available candidates even if near-miss suggestions are available
- add Solutions if no near-miss is available, but there are only three candidates or less
- make offsetWithRange mutating
- remove XCTAssertElements test helper
* address review feedback
- add DescribedError conformance TopicReferenceResolutionError
- improve Hashable implementation of TopicReferenceResolutionError by storing properties demanded by DescribedError instead of raw Error
- conform Replacement and Solution to Hashable to aid Hashable implementation of TopicReferenceResolutionError
- add fixme regarding support for regular markdown link-style references when creating solutions (#470)
- add basic semantic information about possible solutions back into PathHierarchyTests
- remove debug print in SymbolTests
* add assertions for solutions in SymbolTests/testUnresolvedReferenceWarningsInDocComment() + improve improve documentation about indices in source locations
---------
Co-authored-by: David Rönnqvist <[email protected]>
rdar://103279313
returnTopicReferenceResolutionError("No local documentation matches this reference.", note:availabilityNote(category:"top-level elements", candidates: availableChildren))
848
+
case.unfindableMatch:
849
+
returnTopicReferenceResolutionError("No local documentation matches this reference.")
850
+
case.nonSymbolMatchForSymbolLink:
851
+
returnTopicReferenceResolutionError("Symbol links can only resolve symbols.", solutions:[
852
+
Solution(summary:"Use a '<doc:>' style reference.", replacements:[
853
+
// the SourceRange points to the opening double-backtick
letcollisionDescription= collisions.map{"Append '-\($0.disambiguation)' to refer to \($0.node.fullNameOfValue(context: context).singleQuoted)"}.sorted()
851
-
return"Reference is ambiguous after \(partialResult.pathWithoutDisambiguation().singleQuoted): \(collisionDescription.joined(separator:". "))."
879
+
varmessage:String{
880
+
varsuggestion:String{
881
+
switch nearMisses.count {
882
+
case0:
883
+
return"No similar pages."
884
+
case1:
885
+
return"Did you mean \(nearMisses[0])?"
886
+
default:
887
+
return"Did you mean one of: \(nearMisses.joined(separator:", "))?"
888
+
}
889
+
}
890
+
891
+
return"Reference at \(partialResult.pathWithoutDisambiguation().singleQuoted) can't resolve \(remainingSubpath.singleQuoted). \(suggestion)"
0 commit comments