-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Treat special property access symbol differently when retriving documentation #10426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
... when retriving documentation
// The pattern of such special property access is that the parent symbol is the symbol of the file. | ||
if (symbol.parent && forEach(symbol.parent.declarations, declaration => declaration.kind === SyntaxKind.SourceFile)) { | ||
forEach(symbol.declarations, declaration => { | ||
if (declaration.parent && declaration.parent.kind === SyntaxKind.BinaryExpression) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: invert the condition to reduce nesting
👍 with a few nits |
if (rhsSymbol) { | ||
documentation = rhsSymbol.getDocumentationComment(); | ||
if (documentation.length > 0) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break
since you are not in lambda anymore
//// * @param {string} p1 | ||
//// */ | ||
//// var foo = function (p1) { } | ||
//// exports.foo = foo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we also add test for module.exports.foo
case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #9518
We used to not be able to get documentation for the following case:
The completion entry detail at cursor position is supposed to show
Modify the parameter
comment but it wasn't. This PR fixes the issue.