(options: ExtractJSDocsOptions)
| 1772 | >() |
| 1773 | for (const link of collectJSDocLinks(sourceFile, block)) { |
| 1774 | const text = link.getText(sourceFile) |
| 1775 | const target = extractInlineLinkTarget(text) |
| 1776 | if (target === "" || urlRegex.test(target)) continue |
| 1777 | const symbol = resolveJSDocLinkSymbol(link, linkContext.checker) |
| 1778 | const info = symbol === undefined ? undefined : inlineLinkSymbol(symbol, linkContext.cwd, linkContext.checker) |
| 1779 | const items = resolved.get(text) ?? [] |
| 1780 | items.push(info === undefined ? { range: [link.pos, link.end] } : { range: [link.pos, link.end], symbol: info }) |
| 1781 | resolved.set(text, items) |
| 1782 | } |
| 1783 | return { |
| 1784 | ...tags, |
| 1785 | see: tags.see.map((tag) => ({ |
| 1786 | ...tag, |
| 1787 | links: tag.links.map((link) => { |
| 1788 | const items = resolved.get(link.raw) |
| 1789 | const info = items?.shift() |
| 1790 | if (info === undefined) return link |
| 1791 | return info.symbol === undefined |
| 1792 | ? { ...link, range: info.range } |
| 1793 | : { ...link, range: info.range, symbol: info.symbol } |
| 1794 | }) |
| 1795 | })) |
| 1796 | } |
| 1797 | } |
| 1798 | |
| 1799 | function attachSeeLinkSymbols<T extends ParsedDeclarationTags | ParsedNamespaceTags | ParsedMemberTags>( |
| 1800 | tags: T, |
| 1801 | node: ts.Node, |
| 1802 | block: JSDocBlock, |
| 1803 | linkContext: { readonly checker: ts.TypeChecker; readonly entry: ProgramCacheEntry; readonly cwd: string } |
| 1804 | ): T { |
| 1805 | return attachSeeLinkSymbolsFromSourceFile(tags, node.getSourceFile(), block, linkContext) |
| 1806 | } |
| 1807 | |
| 1808 | /** |
| 1809 | * JSDoc diagnostic paired with its source range. |
| 1810 | * |
| 1811 | * @category models |
| 1812 | * @since 4.0.0 |
| 1813 | */ |
| 1814 | export interface JSDocModelDiagnostic extends JSDocDiagnostic { |
| 1815 | readonly range: readonly [number, number] |
| 1816 | } |
| 1817 | |
| 1818 | /** |
| 1819 | * Parsed JSDoc and diagnostics for one source file in a model. |
| 1820 | * |
| 1821 | * @category models |
| 1822 | * @since 4.0.0 |
| 1823 | */ |
| 1824 | export interface JSDocModelFile extends ParsedJSDocFile { |
| 1825 | readonly file: string |
| 1826 | readonly hash: string |
| 1827 | readonly diagnostics: ReadonlyArray<JSDocModelDiagnostic> |
no test coverage detected
searching dependent graphs…