Skip to content

Commit c8f53ff

Browse files
committed
[index] Disable typo-correction when indexing
The errors won't be captured in the response, and it can be expensive to do typo-correction when there are many errors, which is common in indexing. rdar://problem/28963058
1 parent 2d83354 commit c8f53ff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void trace::initTraceFiles(trace::SwiftInvocation &SwiftArgs,
196196

197197
void SwiftLangSupport::indexSource(StringRef InputFile,
198198
IndexingConsumer &IdxConsumer,
199-
ArrayRef<const char *> Args,
199+
ArrayRef<const char *> OrigArgs,
200200
StringRef Hash) {
201201
std::string Error;
202202
auto InputBuf = ASTMgr->getMemoryBuffer(InputFile, Error);
@@ -214,6 +214,12 @@ void SwiftLangSupport::indexSource(StringRef InputFile,
214214
PrintingDiagnosticConsumer PrintDiags;
215215
CI.addDiagnosticConsumer(&PrintDiags);
216216

217+
// Add -disable-typo-correction, since the errors won't be captured in the
218+
// response, and it can be expensive to do typo-correction when there are many
219+
// errors, which is common in indexing.
220+
SmallVector<const char *, 16> Args(OrigArgs.begin(), OrigArgs.end());
221+
Args.push_back("-disable-typo-correction");
222+
217223
CompilerInvocation Invocation;
218224
bool Failed = getASTManager().initCompilerInvocation(Invocation, Args,
219225
CI.getDiags(),

0 commit comments

Comments
 (0)