From ff4147af01c1b3fb444dd54736d710d1b9b1f32b Mon Sep 17 00:00:00 2001 From: Dan Corder Date: Mon, 7 Dec 2015 19:46:37 +0000 Subject: [PATCH 1/2] Fix for #5058 - Exclude implemented interface functions from autocompletion suggestions. --- src/services/services.ts | 3 ++- ...etionListImplementingInterfaceFunctions.ts | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts diff --git a/src/services/services.ts b/src/services/services.ts index 4e0a0265b91..a9dda549ead 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3751,7 +3751,8 @@ namespace ts { // Ignore omitted expressions for missing members if (m.kind !== SyntaxKind.PropertyAssignment && m.kind !== SyntaxKind.ShorthandPropertyAssignment && - m.kind !== SyntaxKind.BindingElement) { + m.kind !== SyntaxKind.BindingElement && + m.kind !== SyntaxKind.MethodDeclaration) { continue; } diff --git a/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts new file mode 100644 index 00000000000..ef155b315e0 --- /dev/null +++ b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts @@ -0,0 +1,26 @@ +/// + +////interface I1 { +//// a(): void; +//// b(): void; +////} +//// +////var imp1: I1 { +//// a() {}, +//// /*0*/ +////} +//// +////interface I2 { +//// a(): void; +//// b(): void; +////} +//// +////var imp2: I2 { +//// a: () => {}, +//// /*1*/ +////} + +goTo.marker("0"); +verify.not.completionListContains("a"); +goTo.marker("1"); +verify.not.completionListContains("a"); From c6feaa016a92ff3ef9ba36ea6694a43f04712e2d Mon Sep 17 00:00:00 2001 From: Dan Corder Date: Mon, 7 Dec 2015 22:43:44 +0000 Subject: [PATCH 2/2] Remove unnecessary I2 from test case --- .../completionListImplementingInterfaceFunctions.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts index ef155b315e0..06a1c24230c 100644 --- a/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts +++ b/tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts @@ -10,12 +10,7 @@ //// /*0*/ ////} //// -////interface I2 { -//// a(): void; -//// b(): void; -////} -//// -////var imp2: I2 { +////var imp2: I1 { //// a: () => {}, //// /*1*/ ////}