mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 15:45:27 -05:00
Use only immediately preceding JSDoc
Now only the immediately preceding jsdoc of a node is retrieved by getJSDoc, although it still does the correct non-local lookup for nodes like ParameterDeclaration. This doesn't change parsing or binding, which use the per-node Node.jsdoc property directly. But it does change everything that relies on getJSDoc, which includes the checker and language service. Fixes #32062, which contains the analysis that justifies the change.
This commit is contained in:
@@ -2201,13 +2201,13 @@ namespace ts {
|
||||
let result: (JSDoc | JSDocTag)[] | undefined;
|
||||
// Pull parameter comments from declaring function as well
|
||||
if (isVariableLike(hostNode) && hasInitializer(hostNode) && hasJSDocNodes(hostNode.initializer!)) {
|
||||
result = addRange(result, (hostNode.initializer as HasJSDoc).jsDoc!);
|
||||
result = append(result, last((hostNode.initializer as HasJSDoc).jsDoc!));
|
||||
}
|
||||
|
||||
let node: Node | undefined = hostNode;
|
||||
while (node && node.parent) {
|
||||
if (hasJSDocNodes(node)) {
|
||||
result = addRange(result, node.jsDoc!);
|
||||
result = append(result, last(node.jsDoc!));
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.Parameter) {
|
||||
|
||||
Reference in New Issue
Block a user