Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
lit26 committed Mar 9, 2024
1 parent 445886f commit 220ba97
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/plugin/utils/ast-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,18 @@ export function getDefaultTypeFormatFlags(enclosingNode: Node) {
return formatFlags;
}

export function getMainCommentOfNode(
node: Node,
sourceFile: SourceFile
): string {
export function getDocComment(node: Node): DocComment {
const tsdocParser: TSDocParser = new TSDocParser();
const parserContext: ParserContext = tsdocParser.parseString(
node.getFullText()
);
const docComment: DocComment = parserContext.docComment;
return parserContext.docComment;
}
export function getMainCommentOfNode(
node: Node,
sourceFile: SourceFile
): string {
const docComment = getDocComment(node);
return renderDocNode(docComment.summarySection).trim();
}

Expand All @@ -168,11 +171,7 @@ export function parseCommentDocValue(docValue: string, type: ts.Type) {
}

export function getTsDocTagsOfNode(node: Node, typeChecker: TypeChecker) {
const tsdocParser: TSDocParser = new TSDocParser();
const parserContext: ParserContext = tsdocParser.parseString(
node.getFullText()
);
const docComment: DocComment = parserContext.docComment;
const docComment = getDocComment(node);

const tagDefinitions: {
[key: string]: {
Expand Down

0 comments on commit 220ba97

Please sign in to comment.