Skip to content

Commit 8ad68ad

Browse files
arusakovmhegazy
authored andcommitted
Fix #10108 (Completion suggestion for object literal with getter) (#11808)
* Fix #10108 (Completion suggestion for object literal with getter) * completions for setter
1 parent f6b82d5 commit 8ad68ad

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/services/completions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,9 @@ namespace ts.Completions {
15901590
if (m.kind !== SyntaxKind.PropertyAssignment &&
15911591
m.kind !== SyntaxKind.ShorthandPropertyAssignment &&
15921592
m.kind !== SyntaxKind.BindingElement &&
1593-
m.kind !== SyntaxKind.MethodDeclaration) {
1593+
m.kind !== SyntaxKind.MethodDeclaration &&
1594+
m.kind !== SyntaxKind.GetAccessor &&
1595+
m.kind !== SyntaxKind.SetAccessor) {
15941596
continue;
15951597
}
15961598

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/// <reference path="../fourslash.ts"/>
2+
3+
// issue: https://github.com/Microsoft/TypeScript/issues/10108
4+
5+
//// interface Foo {
6+
//// one: any;
7+
//// two: any;
8+
//// three: any;
9+
//// }
10+
////
11+
//// let x: Foo = {
12+
//// get one() { return "" },
13+
//// set two(t) {},
14+
//// /**/
15+
//// }
16+
17+
goTo.marker("");
18+
verify.completionListContains("three");
19+
verify.not.completionListContains("one");
20+
verify.not.completionListContains("two");

0 commit comments

Comments
 (0)