mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 17:05:58 -05:00
Fix completions triggered on existing private identifier property access (#36191)
This commit is contained in:
@@ -877,7 +877,7 @@ namespace ts.Completions {
|
||||
|
||||
// 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|
|
||||
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
|
||||
if (contextToken && position <= contextToken.end && (isIdentifier(contextToken) || isKeyword(contextToken.kind))) {
|
||||
if (contextToken && position <= contextToken.end && (isIdentifierOrPrivateIdentifier(contextToken) || isKeyword(contextToken.kind))) {
|
||||
const start = timestamp();
|
||||
contextToken = findPrecedingToken(contextToken.getFullStart(), sourceFile, /*startNode*/ undefined)!; // TODO: GH#18217
|
||||
log("getCompletionData: Get previous token 2: " + (timestamp() - start));
|
||||
|
||||
21
tests/cases/fourslash/completionsECMAPrivateMember.ts
Normal file
21
tests/cases/fourslash/completionsECMAPrivateMember.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @target: esnext
|
||||
|
||||
////class K {
|
||||
//// #value: number;
|
||||
////
|
||||
//// foo() {
|
||||
//// this.#va/**/
|
||||
//// }
|
||||
////}
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
exact: [{
|
||||
name: "#value",
|
||||
insertText: undefined
|
||||
}, {
|
||||
name: "foo"
|
||||
}]
|
||||
});
|
||||
Reference in New Issue
Block a user