Skip to content

Commit

Permalink
Merge pull request swiftlang#5695 from benlangmuir/disable-typo-corre…
Browse files Browse the repository at this point in the history
…ct-index
  • Loading branch information
swift-ci authored Nov 9, 2016
2 parents 2ac37cb + c8f53ff commit 4ee4703
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/Sema/typo_correction.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// RUN: %target-parse-verify-swift
// RUN: not %target-swift-frontend -parse -disable-typo-correction %s 2>&1 | %FileCheck %s -check-prefix=DISABLED
// DISABLED-NOT: did you mean

// This is close enough to get typo-correction.
func test_short_and_close() {
Expand Down
8 changes: 7 additions & 1 deletion tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(),
Expand Down

0 comments on commit 4ee4703

Please sign in to comment.