/** * TreeSitterService, Grammar loading, parsing, and tree caching. * * Grammar WASM files are embedded in the compiled binary via Bun's * `with { type: 'file' }` import assertion (see embedded-wasm.ts). * Missing grammars are handled gracefully (returns null, logs warning). * Never throws, callers receive null on failure. */ import { Language, Tree } from 'web-tree-sitter'; import type { QueryMatch } from 'web-tree-sitter'; export declare class TreeSitterService { private parser; private initialized; private initPromise; private languages; private treeCache; /** * Initialize the WASM module. Safe to call multiple times, only runs once. * Must be called before parse() will work. */ initialize(): Promise; /** * Load a language grammar by ID. Grammars are loaded lazily and cached. * Returns null if the grammar WASM file is not available. */ loadLanguage(langId: string): Promise; /** * Parse a file and cache the result. * Returns null if WASM is not initialized or grammar is unavailable. */ parse(filePath: string, content: string, langId?: string): Promise; /** Invalidate the cached tree for a file (call after edits). */ invalidate(filePath: string): void; /** * Run a tree-sitter Query on a parsed tree. * Returns an empty array if the query fails. */ query(tree: Tree, language: Language, queryString: string): QueryMatch[]; /** Current number of cached trees. */ get cacheSize(): number; /** Loaded language IDs. */ get loadedLanguages(): string[]; /** * Free all resources held by this service instance. */ dispose(): void; } //# sourceMappingURL=service.d.ts.map