@@ -21,8 +21,6 @@ class MonitorXcode {
21
21
22
22
// Currently running Xcode process
23
23
static weak var runningXcode : MonitorXcode ?
24
- // One compilation at a time.
25
- static let compileQueue = DispatchQueue ( label: " InjectionCompile " )
26
24
// Trying to avoid fragmenting memory
27
25
var lastFilelist : String ? , lastArguments : [ String ] ? , lastSource : String ?
28
26
// The service to recompile and inject a source file.
@@ -219,21 +217,12 @@ class MonitorXcode {
219
217
let update = NextCompiler . Compilation ( arguments: args,
220
218
swiftFiles: swiftFiles, workingDir: workingDir)
221
219
222
- // The folling line should be on the compileQueue
223
- // but it seems to provoke a Swift compiler bug.
224
- self . recompiler. compilations [ source] = update
225
- Self . compileQueue. async {
226
- if source == self . recompiler. pendingSource {
227
- print ( " Delayed injection of " + source)
228
- self . recompiler. pendingSource = nil
229
- _ = self . recompiler. inject ( source: source)
230
- }
231
- }
220
+ recompiler. store ( compilation: update, for: source)
232
221
} else if line ==
233
222
" key.request: source.request.indexer.editor-did-save-file, " ,
234
223
let _ = xcodeStdout. readLine ( ) , let source = readQuotedString ( ) {
235
224
print ( " Injecting saved file " + source)
236
- Self . compileQueue. async {
225
+ NextCompiler . compileQueue. async {
237
226
_ = self . recompiler. inject ( source: source)
238
227
}
239
228
}
0 commit comments