Skip to content

restore JSDoc member name check for private identifier references#4449

Open
aamoghS wants to merge 4 commits into
microsoft:mainfrom
aamoghS:fix/private-identifier-jsdoc-reference
Open

restore JSDoc member name check for private identifier references#4449
aamoghS wants to merge 4 commits into
microsoft:mainfrom
aamoghS:fix/private-identifier-jsdoc-reference

Conversation

@aamoghS

@aamoghS aamoghS commented Jun 26, 2026

Copy link
Copy Markdown

This PR restores the isJSDocMemberName check for KindPrivateIdentifier in isValidReferencePosition(), and implements the missing isJSDocMemberName helper function, aligning with the original TypeScript implementation.

Copilot AI review requested due to automatic review settings June 26, 2026 02:17
@aamoghS aamoghS changed the title implement getContextNode for ForOf, ForIn, and Switch statements restore JSDoc member name check for private identifier references Jun 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the language service “Find All References” token-validation logic for PrivateIdentifier nodes by reintroducing a JSDoc-related exception and adding a new isJSDocMemberName helper.

Changes:

  • Adds a JSDoc member-name check for PrivateIdentifier handling in isValidReferencePosition.
  • Introduces isJSDocMemberName to recognize JSDoc-style member-name shapes.

Comment on lines +2655 to +2666
func isJSDocMemberName(node *ast.Node) bool {
if node == nil {
return false
}
if node.Kind == ast.KindIdentifier || node.Kind == ast.KindPrivateIdentifier {
return true
}
if node.Kind == ast.KindPropertyAccessExpression {
return isJSDocMemberName(node.AsPropertyAccessExpression().Name)
}
return false
}
Comment on lines 348 to 354
func isValidReferencePosition(node *ast.Node, searchSymbolName string) bool {
switch node.Kind {
case ast.KindPrivateIdentifier:
// !!!
// if (isJSDocMemberName(node.Parent)) {
// return true;
// }
if isJSDocMemberName(node.Parent) {
return true
}
return len(node.Text()) == len(searchSymbolName)
@jakebailey

Copy link
Copy Markdown
Member

This needs tests that show this does something; it might not due to reparsing

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment on lines 350 to +353
case ast.KindPrivateIdentifier:
// !!!
// if (isJSDocMemberName(node.Parent)) {
// return true;
// }
if isJSDocMemberName(node.Parent) {
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants