Skip to content

Commit d63419d

Browse files
committed
Address review comments
1 parent da90f34 commit d63419d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/Diagnose/RequestInfo.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ package struct RequestInfo: Sendable {
8989
package init(request: String) throws {
9090
var requestTemplate = request
9191

92-
// If the request contained source text, remove it. We want to pick it up from the file on disk and most (possibly
93-
// all) sourcekitd requests use key.sourcefile if key.sourcetext is missing.
9492
requestTemplate.replace(#/ *key.sourcetext: .*\n/#, with: #"key.sourcetext: $FILE_CONTENTS\#n"#)
9593

9694
let sourceFilePath: URL
@@ -188,7 +186,7 @@ private func extractSourceFile(from requestTemplate: String) throws -> (template
188186
switch (sourceFilePath, namePath) {
189187
case (let sourceFilePath?, let namePath?):
190188
if sourceFilePath != namePath {
191-
throw GenericError("Mismatching find key.sourcefile and key.name in the request")
189+
throw GenericError("Mismatching key.sourcefile and key.name in the request: \(sourceFilePath) vs. \(namePath)")
192190
}
193191
return (requestTemplate, URL(fileURLWithPath: sourceFilePath))
194192
case (let sourceFilePath?, nil):

Sources/SourceKitD/SourceKitD.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ package actor SourceKitD {
345345
case requests.codeCompleteClose:
346346
contextualRequests[documentUrl, default: []].removeAll(where: { $0.kind == .codeCompleteOpen })
347347
if contextualRequests[documentUrl]?.isEmpty ?? false {
348+
// This should never happen because we should still have an active `.editorOpen` contextual request but just be
349+
// safe in case we don't.
348350
contextualRequests[documentUrl] = nil
349351
}
350352
default:

0 commit comments

Comments
 (0)