Skip to content

Commit decbeba

Browse files
committed
[Diagnose] Remove key.sourcetext from the request
If the request contained source text, remove it. We want to pick it up from the file on disk and most (possibly all) sourcekitd requests use key.sourcefile if key.sourcetext is missing.
1 parent 7f7a769 commit decbeba

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/Diagnose/RequestInfo.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ public struct RequestInfo {
7777
offset = 0
7878
}
7979

80+
// If the request contained source text, remove it. We want to pick it up from the file on disk and most (possibly
81+
// all) sourcekitd requests use key.sourcefile if key.sourcetext is missing.
82+
requestTemplate.replace(#/ *key.sourcetext: .*\n/#, with: "")
83+
8084
// Extract source file
8185
let sourceFileRegex = Regex {
8286
#"key.sourcefile: ""#

0 commit comments

Comments
 (0)