From 40e0fc7efc7199ddf02cd6d7f763994567526274 Mon Sep 17 00:00:00 2001 From: arusakov Date: Sun, 23 Oct 2016 23:39:44 +0300 Subject: [PATCH] Fix #10108 (Completion suggestion for object literal with getter) --- src/services/completions.ts | 3 ++- tests/cases/fourslash/server/completions03.ts | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/server/completions03.ts diff --git a/src/services/completions.ts b/src/services/completions.ts index ba5d150307519..9bd735f773ddd 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1590,7 +1590,8 @@ namespace ts.Completions { if (m.kind !== SyntaxKind.PropertyAssignment && m.kind !== SyntaxKind.ShorthandPropertyAssignment && m.kind !== SyntaxKind.BindingElement && - m.kind !== SyntaxKind.MethodDeclaration) { + m.kind !== SyntaxKind.MethodDeclaration && + m.kind !== SyntaxKind.GetAccessor) { continue; } diff --git a/tests/cases/fourslash/server/completions03.ts b/tests/cases/fourslash/server/completions03.ts new file mode 100644 index 0000000000000..da8c75f3c6f56 --- /dev/null +++ b/tests/cases/fourslash/server/completions03.ts @@ -0,0 +1,17 @@ +/// + +// issue: https://github.com/Microsoft/TypeScript/issues/10108 + +//// interface Foo { +//// one: any; +//// two: any; +//// } +//// +//// let x: Foo = { +//// get one() { return "" }, +//// /**/ +//// } + +goTo.marker(""); +verify.completionListContains("two"); +verify.not.completionListContains("one");