зеркало из https://github.com/microsoft/lsif-node.git
Add support for files with JsDoc type definitions
This commit is contained in:
Родитель
00a07c32a3
Коммит
15c34965ec
|
@ -3479,6 +3479,21 @@ class Visitor {
|
|||
}
|
||||
|
||||
private endVisitSourceFile(sourceFile: ts.SourceFile): void {
|
||||
if (sourceFile.endOfFileToken) {
|
||||
// Check if we have some dangling JSDoc comments not attached
|
||||
// to any previous statement
|
||||
const jsDoc = tss.Node.getJsDoc(sourceFile.endOfFileToken);
|
||||
if (jsDoc !== undefined) {
|
||||
for (const doc of jsDoc) {
|
||||
const tags = doc.tags;
|
||||
if (tags !== undefined) {
|
||||
for (const tag of tags) {
|
||||
this.handleSymbol(this.tsProject.getSymbolAtLocation(tag), tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.isFullContentIgnored(sourceFile)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -272,10 +272,18 @@ interface InternalNode extends ts.Node {
|
|||
symbol?: ts.Symbol;
|
||||
}
|
||||
|
||||
interface InternalJSDocContainer extends ts.JSDocContainer {
|
||||
jsDoc?: ts.JSDoc[];
|
||||
}
|
||||
|
||||
export namespace Node {
|
||||
export function getSymbol(node: ts.Node): ts.Symbol | undefined {
|
||||
return (node as InternalNode).symbol;
|
||||
}
|
||||
|
||||
export function getJsDoc(node: ts.Token<ts.SyntaxKind.EndOfFileToken>): ts.JSDoc[] | undefined {
|
||||
return (node as InternalJSDocContainer).jsDoc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче