Skip to content

Commit afa11d3

Browse files
a-tarasyukDanielRosenwasser
authored andcommitted
fix(34621): show suggestions in class property initializer (#35999)
1 parent 94e8db7 commit afa11d3

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/services/completions.ts

+3
Original file line numberDiff line numberDiff line change
@@ -2608,6 +2608,9 @@ namespace ts.Completions {
26082608
if (!contextToken) return undefined;
26092609

26102610
switch (contextToken.kind) {
2611+
case SyntaxKind.EqualsToken: // class c { public prop = | /* global completions */ }
2612+
return undefined;
2613+
26112614
case SyntaxKind.SemicolonToken: // class c {getValue(): number; | }
26122615
case SyntaxKind.CloseBraceToken: // class c { method() { } | }
26132616
// class c { method() { } b| }
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)