Skip to content

Commit 81a942e

Browse files
authored
Fix completions triggered on existing private identifier property access (#36191)
1 parent a9cbea4 commit 81a942e

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ namespace ts.Completions {
877877

878878
// Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|
879879
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
880-
if (contextToken && position <= contextToken.end && (isIdentifier(contextToken) || isKeyword(contextToken.kind))) {
880+
if (contextToken && position <= contextToken.end && (isIdentifierOrPrivateIdentifier(contextToken) || isKeyword(contextToken.kind))) {
881881
const start = timestamp();
882882
contextToken = findPrecedingToken(contextToken.getFullStart(), sourceFile, /*startNode*/ undefined)!; // TODO: GH#18217
883883
log("getCompletionData: Get previous token 2: " + (timestamp() - start));
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @target: esnext
4+
5+
////class K {
6+
//// #value: number;
7+
////
8+
//// foo() {
9+
//// this.#va/**/
10+
//// }
11+
////}
12+
13+
verify.completions({
14+
marker: "",
15+
exact: [{
16+
name: "#value",
17+
insertText: undefined
18+
}, {
19+
name: "foo"
20+
}]
21+
});

0 commit comments

Comments
 (0)