UNPKG

@prisma/language-server

Version:
49 lines (48 loc) 1.8 kB
import { type PrismaConfigInternal } from '@prisma/config'; import { Position } from 'vscode-languageserver'; import { TextDocument } from 'vscode-languageserver-textdocument'; export type Line = { readonly document: SchemaDocument; readonly lineIndex: number; readonly text: string; readonly untrimmedText: string; }; export declare class SchemaDocument { readonly textDocument: TextDocument; readonly lines: Line[]; constructor(textDocument: TextDocument); get uri(): string; get content(): string; positionAt(offset: number): Position; getLineContent(lineIndex: number): string; } type FindRegexpResult = { match: RegExpExecArray; documentUri: string; }; /** * Will try to load the prisma config file from the given path, default path or create a default config. */ export declare function loadConfig(configRoot?: string): Promise<PrismaConfigInternal>; type PrismaSchemaInput = { currentDocument: TextDocument; allDocuments: TextDocument[]; } | SchemaDocument[]; export declare class PrismaSchema { readonly documents: SchemaDocument[]; readonly config?: PrismaConfigInternal | undefined; static singleFile(textDocument: TextDocument): PrismaSchema; static load(input: PrismaSchemaInput, configRoot?: string): Promise<PrismaSchema>; constructor(documents: SchemaDocument[], config?: PrismaConfigInternal | undefined); iterLines(): Generator<Line, void, void>; linesAsArray(): Line[]; findDocByUri(fileUri: string): SchemaDocument | undefined; findWithRegex(regexp: RegExp): FindRegexpResult | undefined; /** * * @returns array of (uri, content) tuples. Expected input for prisma-schema-wasm */ toTuples(): Array<[string, string]>; toJSON(): [string, string][]; } export {};