Skip to content

Commit 32a6d7d

Browse files
committed
[IDE] Make sure to disable typo-correction when doing code-completion.
Typo-correction can be expensive and we don't need it for code-completion.
1 parent 386b4b4 commit 32a6d7d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

include/swift/Frontend/Frontend.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ class CompilerInvocation {
263263
assert(Buf);
264264
CodeCompletionBuffer = Buf;
265265
CodeCompletionOffset = Offset;
266+
// We don't need typo-correction for code-completion.
267+
LangOpts.DisableTypoCorrection = true;
266268
}
267269

268270
std::pair<llvm::MemoryBuffer *, unsigned> getCodeCompletionPoint() const {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=HERE -code-completion-diagnostics 2> %t.err.txt
2+
// RUN: %FileCheck %s -input-file=%t.err.txt
3+
4+
// CHECK: use of unresolved identifier 'foo11'
5+
// CHECK-NOT: did you mean
6+
7+
func foo12() -> Int { return 0 }
8+
9+
class C {
10+
var p = foo11()
11+
}
12+
13+
C().#^HERE^#

0 commit comments

Comments
 (0)