Skip to content

Commit 97beaec

Browse files
Apply suggestions from code review
Co-authored-by: Alex Hoppen <alex@alexhoppen.de>
1 parent 2f10885 commit 97beaec

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

Sources/DocumentationLanguageService/DocumentationLanguageService.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ package actor DocumentationLanguageService: LanguageService, Sendable {
115115
throw ResponseError.requestNotImplemented(HoverRequest.self)
116116
}
117117

118-
let uri = req.textDocument.uri
119-
let snapshot = try documentManager.latestSnapshot(uri)
118+
let snapshot = try documentManager.latestSnapshot(req.textDocument.uri)
120119

121120
guard snapshot.language == .swift else {
122121
throw ResponseError.requestNotImplemented(HoverRequest.self)
@@ -148,9 +147,7 @@ package actor DocumentationLanguageService: LanguageService, Sendable {
148147
catalogURL: catalogURL
149148
)
150149

151-
guard let renderNodeData = doccResponse.renderNode.data(using: .utf8) else {
152-
throw ResponseError.requestNotImplemented(HoverRequest.self)
153-
}
150+
let renderNodeData = Array(doccResponse.renderNode.utf8)
154151
let renderNode = try JSONDecoder().decode(RenderNode.self, from: renderNodeData)
155152

156153
guard let markdown = renderNodeToMarkdown(renderNode) else {
@@ -170,7 +167,7 @@ package actor DocumentationLanguageService: LanguageService, Sendable {
170167
for section in sections {
171168
if let declSection = section as? DeclarationsRenderSection,
172169
let declaration = declSection.declarations.first {
173-
let sourceText = declaration.tokens.map { $0.text }.joined()
170+
let sourceText = declaration.tokens.map(\.text).joined()
174171
result += "```swift\n\(sourceText)\n```\n"
175172
}
176173
}

0 commit comments

Comments
 (0)