Skip to content

Commit f37acba

Browse files
authored
Merge pull request #5968 from akyrtzi/code-completion-disable-typo-correction
[IDE] Make sure to disable typo-correction when doing code-completion.
2 parents d5ba131 + 5a7c9a2 commit f37acba

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
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 {

test/IDE/complete_at_top_level.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@ func resyncParserB11() {}
396396
// rdar://21346928
397397
func optStr() -> String? { return nil }
398398
let x = (optStr() ?? "autoclosure").#^TOP_LEVEL_AUTOCLOSURE_1^#
399-
// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: utf16[#String.UTF16View#]
400399
// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: characters[#String.CharacterView#]
400+
// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: utf16[#String.UTF16View#]
401401
// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: utf8[#String.UTF8View#]
402402

403403
func resyncParserB12() {}
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)