import { CancellationToken , CompletionContext , FileChangeType , LinkedEditingRanges , SemanticTokens , SignatureHelpContext , TextDocumentContentChangeEvent } from 'vscode-languageserver' ; import { CodeAction , CodeActionContext , Color , ColorInformation , ColorPresentation , CompletionItem , CompletionList , DefinitionLink , Diagnostic , FormattingOptions , Hover , Location , Position , Range , ReferenceContext , SymbolInformation , TextDocumentIdentifier , TextEdit , WorkspaceEdit , SelectionRange , SignatureHelp } from 'vscode-languageserver-types' ; import { Document } from '../lib/documents' ; export type Resolvable < T > = T | Promise < T > ; export interface AppCompletionItem < T extends TextDocumentIdentifier = any > extends CompletionItem { data ? : T ; } export interface AppCompletionList < T extends TextDocumentIdentifier = any > extends CompletionList { items : Array < AppCompletionItem < T > > ; } export interface DiagnosticsProvider { getDiagnostics ( document ) : Resolvable < Diagnostic [ ] > ; } export interface HoverProvider { doHover ( document , position ) : Resolvable < Hover | null > ; } export interface CompletionsProvider < T extends TextDocumentIdentifier = any > { getCompletions ( document , position , completionContext ? , cancellationToken ? ) : Resolvable < AppCompletionList < T > | null > ; resolveCompletion ? ( document , completionItem , cancellationToken ? ) : Resolvable < AppCompletionItem < T > > ; } export interface FormattingProvider { formatDocument ( document , options ) : Resolvable < TextEdit [ ] > ; } export interface TagCompleteProvider { doTagComplete ( document , position ) : Resolvable < string | null > ; } export interface DocumentColorsProvider { getDocumentColors ( document ) : Resolvable < ColorInformation [ ] > ; } export interface ColorPresentationsProvider { getColorPresentations ( document , range , color ) : Resolvable < ColorPresentation [ ] > ; } export interface DocumentSymbolsProvider { getDocumentSymbols ( document , cancellationToken ? ) : Resolvable < SymbolInformation [ ] > ; } export interface DefinitionsProvider { getDefinitions ( document , position ) : Resolvable < DefinitionLink [ ] > ; } export interface BackwardsCompatibleDefinitionsProvider { getDefinitions ( document , position ) : Resolvable < DefinitionLink [ ] | Location [ ] > ; } export interface CodeActionsProvider { getCodeActions ( document , range , context , cancellationToken ? ) : Resolvable < CodeAction [ ] > ; executeCommand ? ( document , command , args ? ) : Resolvable < WorkspaceEdit | string | null > ; } export interface FileRename { oldUri : string ; newUri : string ; } export interface UpdateImportsProvider { updateImports ( fileRename ) : Resolvable < WorkspaceEdit | null > ; } export interface RenameProvider { rename ( document , position , newName ) : Resolvable < WorkspaceEdit | null > ; prepareRename ( document , position ) : Resolvable < Range | null > ; } export interface FindReferencesProvider { findReferences ( document , position , context ) : Promise < Location [ ] | null > ; } export interface SignatureHelpProvider { getSignatureHelp ( document , position , context , cancellationToken ? ) : Resolvable < SignatureHelp | null > ; } export interface SelectionRangeProvider { getSelectionRange ( document , position ) : Resolvable < SelectionRange | null > ; } export interface SemanticTokensProvider { getSemanticTokens ( textDocument , range ? ) : Resolvable < SemanticTokens | null > ; } export interface LinkedEditingRangesProvider { getLinkedEditingRanges ( document , position ) : Resolvable < LinkedEditingRanges | null > ; } export interface ImplementationProvider { getImplementation ( document , position ) : Resolvable < Location [ ] | null > ; } export interface TypeDefinitionProvider { getTypeDefinition ( document , position ) : Resolvable < Location [ ] | null > ; } export interface OnWatchFileChangesPara { fileName : string ; changeType : FileChangeType ; } export interface OnWatchFileChanges { onWatchFileChanges ( onWatchFileChangesParas ) : void ; } export interface UpdateTsOrJsFile { updateTsOrJsFile ( fileName , changes ) : void ; } type ProviderBase = DiagnosticsProvider & HoverProvider & CompletionsProvider & FormattingProvider & TagCompleteProvider & DocumentColorsProvider & ColorPresentationsProvider & DocumentSymbolsProvider & UpdateImportsProvider & CodeActionsProvider & FindReferencesProvider & RenameProvider & SignatureHelpProvider & SemanticTokensProvider & LinkedEditingRangesProvider & ImplementationProvider & TypeDefinitionProvider ; export type LSProvider = ProviderBase & BackwardsCompatibleDefinitionsProvider ; export interface LSPProviderConfig { /**
     * Whether or not completion lists that are marked as imcomplete
     * should be filtered server side.
     */ filterIncompleteCompletions : boolean ; /**
     * Whether or not getDefinitions supports the LocationLink interface.
     */ definitionLinkSupport : boolean ; } export type Plugin = Partial < ProviderBase & DefinitionsProvider & OnWatchFileChanges & SelectionRangeProvider & UpdateTsOrJsFile > ;