mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
fix(34621): show suggestions in class property initializer (#35999)
This commit is contained in:
committed by
Daniel Rosenwasser
parent
94e8db7e07
commit
afa11d3c7a
@@ -2608,6 +2608,9 @@ namespace ts.Completions {
|
||||
if (!contextToken) return undefined;
|
||||
|
||||
switch (contextToken.kind) {
|
||||
case SyntaxKind.EqualsToken: // class c { public prop = | /* global completions */ }
|
||||
return undefined;
|
||||
|
||||
case SyntaxKind.SemicolonToken: // class c {getValue(): number; | }
|
||||
case SyntaxKind.CloseBraceToken: // class c { method() { } | }
|
||||
// class c { method() { } b| }
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////class Class1 {
|
||||
//// protected a = /*1*/
|
||||
//// private b = /*2*/
|
||||
//// public c = /*3*/
|
||||
//// public d = this./*4*/
|
||||
////}
|
||||
////
|
||||
////class Class2 {
|
||||
//// a = /*5*/
|
||||
////}
|
||||
////class Class3 {
|
||||
//// a = /*6*/
|
||||
////}
|
||||
////
|
||||
////const prop = 'prop';
|
||||
////class Class4 {
|
||||
//// [prop] = /*7*/
|
||||
////}
|
||||
|
||||
const exact = completion.globalsPlus(["Class1", "Class2", "Class3", "prop", "Class4"]);
|
||||
verify.completions({ marker: ["1"], exact });
|
||||
verify.completions({ marker: ["2"], exact });
|
||||
verify.completions({ marker: ["3"], exact });
|
||||
verify.completions({ marker: ["4"], exact: ['a', 'b', 'c', 'd'], isGlobalCompletion: false });
|
||||
verify.completions({ marker: ["5"], exact });
|
||||
verify.completions({ marker: ["6"], exact });
|
||||
verify.completions({ marker: ["7"], exact });
|
||||
Reference in New Issue
Block a user