From ffe07e7e7128c78ba3ea64b37feaa167ff053a0c Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 5 Oct 2016 14:19:38 -0700 Subject: [PATCH] Fix incorrect returning of completion entries when in string literal of property assignment expression Fixes #11232 --- src/services/services.ts | 4 +++- ...letionListInObjectLiteralPropertyAssignment.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/completionListInObjectLiteralPropertyAssignment.ts diff --git a/src/services/services.ts b/src/services/services.ts index c59fb53282e..b82a26c8039 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -4497,7 +4497,9 @@ namespace ts { return undefined; } - if (node.parent.kind === SyntaxKind.PropertyAssignment && node.parent.parent.kind === SyntaxKind.ObjectLiteralExpression) { + if (node.parent.kind === SyntaxKind.PropertyAssignment && + node.parent.parent.kind === SyntaxKind.ObjectLiteralExpression && + (node.parent).name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { // 'jspm:dev': string diff --git a/tests/cases/fourslash/completionListInObjectLiteralPropertyAssignment.ts b/tests/cases/fourslash/completionListInObjectLiteralPropertyAssignment.ts new file mode 100644 index 00000000000..14ccd985577 --- /dev/null +++ b/tests/cases/fourslash/completionListInObjectLiteralPropertyAssignment.ts @@ -0,0 +1,15 @@ +/// + +////var foo; +////interface I { +//// metadata: string; +//// wat: string; +////} +////var x: I = { +//// metadata: "/*1*/ +////} + +goTo.marker('1'); + +verify.not.completionListContains("metadata"); +verify.not.completionListContains("wat"); \ No newline at end of file