Skip to content

Commit eb47d85

Browse files
committed
fix(34621): show suggestions in class property initializer
1 parent bb306a7 commit eb47d85

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/services/completions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2603,6 +2603,9 @@ namespace ts.Completions {
26032603
if (!contextToken) return undefined;
26042604

26052605
switch (contextToken.kind) {
2606+
case SyntaxKind.EqualsToken: // class c { public prop = | /* global completions */ }
2607+
return undefined;
2608+
26062609
case SyntaxKind.SemicolonToken: // class c {getValue(): number; | }
26072610
case SyntaxKind.CloseBraceToken: // class c { method() { } | }
26082611
// class c { method() { } b| }
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////class Class1 {
4+
//// protected a = /*1*/
5+
//// private b = /*2*/
6+
//// public c = /*3*/
7+
//// public d = this./*4*/
8+
////}
9+
////
10+
////class Class2 {
11+
//// a = /*5*/
12+
////}
13+
////class Class3 {
14+
//// a = /*6*/
15+
////}
16+
////
17+
////const prop = 'prop';
18+
////class Class4 {
19+
//// [prop] = /*7*/
20+
////}
21+
22+
const exact = completion.globalsPlus(["Class1", "Class2", "Class3", "prop", "Class4"]);
23+
verify.completions({ marker: ["1"], exact });
24+
verify.completions({ marker: ["2"], exact });
25+
verify.completions({ marker: ["3"], exact });
26+
verify.completions({ marker: ["4"], exact: ['a', 'b', 'c', 'd'], isGlobalCompletion: false });
27+
verify.completions({ marker: ["5"], exact });
28+
verify.completions({ marker: ["6"], exact });
29+
verify.completions({ marker: ["7"], exact });

0 commit comments

Comments
 (0)