Skip to content

Commit 8bd393a

Browse files
committed
Don’t request syntactic information from sourcekitd on open and edit
Just means that sourcekitd doesn’t need to build a syntax tree, doesn’t have to transfer information that we discard anyway and also doesn’t run `SyntaxModelContext` and thus can’t hit assertion failures within.
1 parent 789ec94 commit 8bd393a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ extension SwiftLanguageServer {
345345
keys.request: self.requests.editorOpen,
346346
keys.name: note.textDocument.uri.pseudoPath,
347347
keys.sourceText: snapshot.text,
348+
keys.enableSyntaxMap: 0,
349+
keys.enableStructure: 0,
350+
keys.enableDiagnostics: 0,
348351
keys.syntacticOnly: 1,
349352
keys.compilerArgs: await self.buildSettings(for: snapshot.uri)?.compilerArgs as [SKDValue]?,
350353
])
@@ -477,6 +480,9 @@ extension SwiftLanguageServer {
477480
let req = sourcekitd.dictionary([
478481
keys.request: self.requests.editorReplaceText,
479482
keys.name: note.textDocument.uri.pseudoPath,
483+
keys.enableSyntaxMap: 0,
484+
keys.enableStructure: 0,
485+
keys.enableDiagnostics: 0,
480486
keys.syntacticOnly: 1,
481487
keys.offset: edit.offset,
482488
keys.length: edit.length,

0 commit comments

Comments
 (0)