Skip to content

Commit c8d937e

Browse files
Merge pull request microsoft#32726 from fuafa/completion-after-private
Fix completion disappear after a property declaration with a private modifier
2 parents df3c746 + e1bca8f commit c8d937e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ namespace ts.Completions {
15661566
// If you're in an interface you don't want to repeat things from super-interface. So just stop here.
15671567
if (!isClassLike(decl)) return GlobalsSearch.Success;
15681568

1569-
const classElement = contextToken.parent;
1569+
const classElement = contextToken.kind === SyntaxKind.SemicolonToken ? contextToken.parent.parent : contextToken.parent;
15701570
let classElementModifierFlags = isClassElement(classElement) ? getModifierFlags(classElement) : ModifierFlags.None;
15711571
// If this is context token is not something we are editing now, consider if this would lead to be modifier
15721572
if (contextToken.kind === SyntaxKind.Identifier && !isCurrentlyEditingNode(contextToken)) {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// interface X {
4+
//// bla: string;
5+
//// }
6+
//// class Y implements X {
7+
//// private blub = "";
8+
//// /**/
9+
//// }
10+
11+
12+
verify.completions({ marker: "", includes: "bla", isNewIdentifierLocation: true });

0 commit comments

Comments
 (0)