UNPKG

2.29 kBTypeScriptView Raw
1import * as ts from 'typescript';
2import { IExcerptToken, IExcerptTokenRange } from '@microsoft/api-extractor-model';
3import { DeclarationReferenceGenerator } from './DeclarationReferenceGenerator';
4import { AstDeclaration } from '../analyzer/AstDeclaration';
5/**
6 * Used to provide ExcerptBuilder with a list of nodes whose token range we want to capture.
7 */
8export interface IExcerptBuilderNodeToCapture {
9 /**
10 * The node to capture
11 */
12 node: ts.Node | undefined;
13 /**
14 * The token range whose startIndex/endIndex will be overwritten with the indexes for the
15 * tokens corresponding to IExcerptBuilderNodeToCapture.node
16 */
17 tokenRange: IExcerptTokenRange;
18}
19export declare class ExcerptBuilder {
20 /**
21 * Appends a blank line to the `excerptTokens` list.
22 * @param excerptTokens - The target token list to append to
23 */
24 static addBlankLine(excerptTokens: IExcerptToken[]): void;
25 /**
26 * Appends the signature for the specified `AstDeclaration` to the `excerptTokens` list.
27 * @param excerptTokens - The target token list to append to
28 * @param nodesToCapture - A list of child nodes whose token ranges we want to capture
29 */
30 static addDeclaration(excerptTokens: IExcerptToken[], astDeclaration: AstDeclaration, nodesToCapture: IExcerptBuilderNodeToCapture[], referenceGenerator: DeclarationReferenceGenerator): void;
31 static createEmptyTokenRange(): IExcerptTokenRange;
32 private static _buildSpan;
33 private static _appendToken;
34 /**
35 * Condenses the provided excerpt tokens by merging tokens where possible. Updates the provided token ranges to
36 * remain accurate after token merging.
37 *
38 * @remarks
39 * For example, suppose we have excerpt tokens ["A", "B", "C"] and a token range [0, 2]. If the excerpt tokens
40 * are condensed to ["AB", "C"], then the token range would be updated to [0, 1]. Note that merges are only
41 * performed if they are compatible with the provided token ranges. In the example above, if our token range was
42 * originally [0, 1], we would not be able to merge tokens "A" and "B".
43 */
44 private static _condenseTokens;
45 private static _isDeclarationName;
46 private static _isDeclaration;
47}
48//# sourceMappingURL=ExcerptBuilder.d.ts.map
\No newline at end of file