Skip to content

Commit 2f5e714

Browse files
authored
Merge pull request #11401 from Microsoft/completionInObjectLiteralAssignment
Fix incorrect returning of completion entries when in string literal of property assignment expression
2 parents eab3711 + 612003d commit 2f5e714

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/services/completions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ namespace ts.Completions {
138138
return undefined;
139139
}
140140

141-
if (node.parent.kind === SyntaxKind.PropertyAssignment && node.parent.parent.kind === SyntaxKind.ObjectLiteralExpression) {
141+
if (node.parent.kind === SyntaxKind.PropertyAssignment &&
142+
node.parent.parent.kind === SyntaxKind.ObjectLiteralExpression &&
143+
(<PropertyAssignment>node.parent).name === node) {
142144
// Get quoted name of properties of the object literal expression
143145
// i.e. interface ConfigFiles {
144146
// 'jspm:dev': string
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////var foo;
4+
////interface I {
5+
//// metadata: string;
6+
//// wat: string;
7+
////}
8+
////var x: I = {
9+
//// metadata: "/*1*/
10+
////}
11+
12+
goTo.marker('1');
13+
14+
verify.not.completionListContains("metadata");
15+
verify.not.completionListContains("wat");

0 commit comments

Comments
 (0)