mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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
This commit is contained in:
@@ -196,7 +196,7 @@ void trace::initTraceFiles(trace::SwiftInvocation &SwiftArgs,
|
||||
|
||||
void SwiftLangSupport::indexSource(StringRef InputFile,
|
||||
IndexingConsumer &IdxConsumer,
|
||||
ArrayRef<const char *> Args,
|
||||
ArrayRef<const char *> OrigArgs,
|
||||
StringRef Hash) {
|
||||
std::string Error;
|
||||
auto InputBuf = ASTMgr->getMemoryBuffer(InputFile, Error);
|
||||
@@ -214,6 +214,12 @@ void SwiftLangSupport::indexSource(StringRef InputFile,
|
||||
PrintingDiagnosticConsumer PrintDiags;
|
||||
CI.addDiagnosticConsumer(&PrintDiags);
|
||||
|
||||
// Add -disable-typo-correction, since 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.
|
||||
SmallVector<const char *, 16> Args(OrigArgs.begin(), OrigArgs.end());
|
||||
Args.push_back("-disable-typo-correction");
|
||||
|
||||
CompilerInvocation Invocation;
|
||||
bool Failed = getASTManager().initCompilerInvocation(Invocation, Args,
|
||||
CI.getDiags(),
|
||||
|
||||
Reference in New Issue
Block a user