UNPKG

yaml-language-server

Version:
61 lines (60 loc) 3.39 kB
import type { Connection } from 'vscode-languageserver'; import type { CodeActionParams, DidChangeWatchedFilesParams, DocumentFormattingParams, DocumentLinkParams, DocumentOnTypeFormattingParams, DocumentSymbolParams, FoldingRangeParams, SelectionRangeParams, TextDocumentPositionParams, CodeLensParams, DefinitionParams, PrepareRenameParams, RenameParams } from 'vscode-languageserver-protocol'; import type { CodeAction, CodeLens, CompletionList, DefinitionLink, DocumentLink, DocumentSymbol, Hover, FoldingRange, Range, SelectionRange, SymbolInformation, TextEdit, WorkspaceEdit } from 'vscode-languageserver-types'; import type { LanguageService } from '../../languageservice/yamlLanguageService'; import type { SettingsState } from '../../yamlSettings'; import type { ValidationHandler } from './validationHandlers'; export declare class LanguageHandlers { private readonly connection; private languageService; private yamlSettings; private validationHandler; pendingLimitExceededWarnings: { [uri: string]: { features: { [name: string]: string; }; timeout?: NodeJS.Timeout; }; }; constructor(connection: Connection, languageService: LanguageService, yamlSettings: SettingsState, validationHandler: ValidationHandler); registerHandlers(): void; documentLinkHandler(params: DocumentLinkParams): Promise<DocumentLink[]>; /** * Called when the code outline in an editor needs to be populated * Returns a list of symbols that is then shown in the code outline */ documentSymbolHandler(documentSymbolParams: DocumentSymbolParams): DocumentSymbol[] | SymbolInformation[]; /** * Called when the formatter is invoked * Returns the formatted document content using prettier */ formatterHandler(formatParams: DocumentFormattingParams): Promise<TextEdit[]>; formatOnTypeHandler(params: DocumentOnTypeFormattingParams): Promise<TextEdit[] | undefined> | TextEdit[] | undefined; /** * Called when the user hovers with their mouse over a keyword * Returns an informational tooltip */ hoverHandler(textDocumentPositionParams: TextDocumentPositionParams): Promise<Hover>; /** * Called when auto-complete is triggered in an editor * Returns a list of valid completion items */ completionHandler(textDocumentPosition: TextDocumentPositionParams): Promise<CompletionList>; /** * Called when a monitored file is changed in an editor * Re-validates the entire document */ watchedFilesHandler(change: DidChangeWatchedFilesParams): void; foldingRangeHandler(params: FoldingRangeParams): Promise<FoldingRange[] | undefined> | FoldingRange[] | undefined; selectionRangeHandler(params: SelectionRangeParams): SelectionRange[] | undefined; codeActionHandler(params: CodeActionParams): CodeAction[] | undefined; codeLensHandler(params: CodeLensParams): Promise<CodeLens[] | undefined>; codeLensResolveHandler(param: CodeLens): PromiseLike<CodeLens> | CodeLens; definitionHandler(params: DefinitionParams): DefinitionLink[]; prepareRenameHandler(params: PrepareRenameParams): Range | null; renameHandler(params: RenameParams): WorkspaceEdit | null; private cancelLimitExceededWarnings; private onResultLimitExceeded; private resolveFormatterState; }