Skip to content

Commit b1d0e17

Browse files
add initializer to LinkCompletionTools.SymbolInformation that accepts a SybolGraph.Symbol
1 parent 65aaf92 commit b1d0e17

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Sources/SwiftDocC/DocumentationService/Convert/Symbol Link Resolution/LinkCompletionTools.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
import Foundation
12+
public import SymbolKit
1213

1314
/// A collection of API for link completion.
1415
///
@@ -184,6 +185,15 @@ public enum LinkCompletionTools {
184185
self.parameterTypes = parameterTypes
185186
self.returnTypes = returnTypes
186187
}
188+
189+
public init(symbol: SymbolGraph.Symbol) {
190+
self.kind = symbol.kind.identifier.identifier
191+
self.symbolIDHash = Self.hash(uniqueSymbolID: symbol.identifier.precise)
192+
if let signature = PathHierarchy.functionSignatureTypeNames(for: symbol) {
193+
self.parameterTypes = signature.parameterTypeNames
194+
self.returnTypes = signature.returnTypeNames
195+
}
196+
}
187197

188198
/// Creates a hashed representation of a symbol's unique identifier.
189199
///

0 commit comments

Comments
 (0)