@vuedx/typescript-plugin-vue
Version:
TypeScript plugin for Vue
59 lines • 2.26 kB
TypeScript
import { ComponentNode, Node, SearchResult } from '@vuedx/template-ast-types';
import { TextSpan, VueSFCDocument } from '@vuedx/vue-virtual-textdocument';
import { FilesystemService } from './FilesystemService';
import { LoggerService } from './LoggerService';
import { TypescriptContextService } from './TypescriptContextService';
export interface TemplateVariableDeclaration {
kind: 'variable' | 'hoist' | 'setup' | 'identifier';
id: string;
name: TextSpan;
initializer: TextSpan;
references: TextSpan[];
}
export interface ComponentExportDeclaration {
kind: 'component';
id: string;
name: TextSpan;
region: TextSpan;
}
export declare type TemplateDeclaration = TemplateVariableDeclaration | ComponentExportDeclaration;
export interface SFCTemplateDeclarations {
declarations: TemplateDeclaration[];
byLine: Map<number, TemplateDeclaration>;
}
export declare const enum GeneratedPositionKind {
UNKNOWN = 0,
COMPONENT_TAG_EXPRESSION = 1,
TEMPLATE_NODE = 2
}
export declare class TemplateDeclarationsService {
private readonly ts;
private readonly fs;
constructor(ts: TypescriptContextService, fs: FilesystemService);
readonly logger: LoggerService;
/** Used by caches */
getVersion(fileName: string): string;
getTemplateDeclarationAt(fileName: string, offset: number): TemplateDeclaration | null;
getTemplateDeclaration(fileName: string): SFCTemplateDeclarations;
getUndefinedGlobals(fileName: string): TemplateVariableDeclaration[];
findTemplateNode(file: VueSFCDocument, position: number): SearchResultWithLocation;
findGeneratedPosition(file: VueSFCDocument, position: number): {
kind: GeneratedPositionKind.UNKNOWN;
position: number;
} | {
kind: GeneratedPositionKind.COMPONENT_TAG_EXPRESSION;
position: number;
node: ComponentNode;
templateRange: TextSpan;
tagType: 'start' | 'end';
} | {
kind: GeneratedPositionKind.TEMPLATE_NODE;
position: number;
node: Node;
templateRange: TextSpan;
} | null;
}
export interface SearchResultWithLocation extends SearchResult {
templateRange: TextSpan;
}
//# sourceMappingURL=TemplateDeclarationsService.d.ts.map