import Parser from 'web-tree-sitter'; import * as monaco from '@opensumi/ide-monaco/lib/common'; import { IDisposable } from '@opensumi/ide-utils'; import { INearestCodeBlock } from '../../common/types'; import { ICodeBlockInfo, IOtherBlockInfo } from './tree-sitter/language-facts/base'; export declare const DEFAULT_MIN_BLOCK_COUNT = 20; export declare class LanguageParser implements IDisposable { private language; private parser; private parserLoaded; private lruCache; private wasmModuleManager; private languageFacts; private constructor(); ready(): Promise; getParser(): Parser; private initializeParser; /** * 从给定的位置开始,向上遍历 AST,找到最近的代码块 * @param node 节点 * @param position 位置 * @returns 代码块 */ private findContainingCodeBlockWithPosition; private findFunctionCodeBlock; parseAST(model: monaco.ITextModel): Promise; getSyntaxNodeAsPosition(model: monaco.ITextModel, cursor: number): Promise; /** * 从给定的位置开始,找到最近的没有语法错误的代码块 */ findCodeBlockWithoutSyntaxError(sourceCode: string, range: monaco.IRange): Promise; provideCodeBlockInfo(model: monaco.ITextModel, position: monaco.Position): Promise; provideCodeBlockInfoInRange(model: monaco.ITextModel, range: monaco.IRange): Promise; trimSuffixSyntaxErrors(code: string, minBlockCount?: number): Promise; trimPrefixSyntaxErrors(code: string, minBlockCount?: number): Promise; trimToLastCompleteBlock(rootNode: Parser.SyntaxNode, reverse?: boolean): string; private findTypeIdentifier; extractImportPaths(code: string): Promise; extractInterfaceOrTypeCode(code: string): Promise; findSyntaxErrorCount(code: string): Promise; findNearestCodeBlockWithPosition(code: string, cursor: number): Promise; dispose(): void; } //# sourceMappingURL=parser.d.ts.map