import { DocumentUri, InlineCompletionContext, WorkspaceFolder } from 'vscode-languageserver'; import { Position, TextDocument } from 'vscode-languageserver-textdocument'; import { LsTextDocuments } from './external_interfaces'; import { SecretRedactor } from './secret_redaction'; export interface IDocContext { /** * The text before the cursor. */ prefix: string; /** * The text after the cursor. */ suffix: string; /** * This is most likely path to a file relative to the workspace * but if the file doesn't belong to a workspace, this field is identical to document URI * * Example: If the workspace root is `/home/user/workspace` * and the file is `/home/user/workspace/src/file.txt`, * then the filename is `src/file.txt`. */ fileRelativePath: string; position: Position; /** * The URI of the document. */ uri: DocumentUri; /** * languageId of the document * @readonly */ languageId: TextDocument['languageId']; /** * The workspace folder that the document belongs to. */ workspaceFolder?: WorkspaceFolder; } export interface IDocTransformer { transform(context: IDocContext): IDocContext; } export interface DocumentTransformerService { get(uri: string): TextDocument | undefined; getContext(uri: string, position: Position, workspaceFolders: WorkspaceFolder[], completionContext?: InlineCompletionContext): IDocContext | undefined; transform(context: IDocContext): IDocContext; } export declare const DocumentTransformerService: import("@gitlab-org/di").InterfaceId; export declare class DefaultDocumentTransformerService implements DocumentTransformerService { #private; constructor(documents: LsTextDocuments, secretRedactor: SecretRedactor); get(uri: string): TextDocument | undefined; getContext(uri: string, position: Position, workspaceFolders: WorkspaceFolder[], completionContext?: InlineCompletionContext): IDocContext | undefined; transform(context: IDocContext): IDocContext; } export declare function getDocContext(document: TextDocument, position: Position, workspaceFolders: WorkspaceFolder[], completionContext?: InlineCompletionContext): IDocContext;