vscode-languageclient
Advanced tools
Comparing version 6.0.0-next.8 to 6.0.0-next.9
@@ -6,9 +6,9 @@ import { Disposable, TextDocument, ProviderResult, Position as VPosition, CallHierarchyItem as VCallHierarchyItem, CallHierarchyIncomingCall as VCallHierarchyIncomingCall, CallHierarchyOutgoingCall as VCallHierarchyOutgoingCall, CancellationToken } from 'vscode'; | ||
export interface PrepareCallHierachySignature { | ||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VCallHierarchyItem>; | ||
(this: void, document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VCallHierarchyItem>; | ||
} | ||
export interface CallHierarchyIncomingCallsSignature { | ||
(item: VCallHierarchyItem, token: CancellationToken): ProviderResult<VCallHierarchyIncomingCall[]>; | ||
(this: void, item: VCallHierarchyItem, token: CancellationToken): ProviderResult<VCallHierarchyIncomingCall[]>; | ||
} | ||
export interface CallHierarchyOutgoingCallsSignature { | ||
(item: VCallHierarchyItem, token: CancellationToken): ProviderResult<VCallHierarchyOutgoingCall[]>; | ||
(this: void, item: VCallHierarchyItem, token: CancellationToken): ProviderResult<VCallHierarchyOutgoingCall[]>; | ||
} | ||
@@ -20,7 +20,16 @@ export interface CallHierarchyMiddleware { | ||
} | ||
export declare class CallHierarchyFeature extends TextDocumentFeature<boolean | CallHierarchyOptions, CallHierarchyRegistrationOptions> { | ||
declare class CallHierarchyProvider implements CallHierarchyProvider { | ||
private client; | ||
private middleware; | ||
constructor(client: BaseLanguageClient); | ||
prepareCallHierarchy(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VCallHierarchyItem>; | ||
provideCallHierarchyIncomingCalls(item: VCallHierarchyItem, token: CancellationToken): ProviderResult<VCallHierarchyIncomingCall[]>; | ||
provideCallHierarchyOutgoingCalls(item: VCallHierarchyItem, token: CancellationToken): ProviderResult<VCallHierarchyOutgoingCall[]>; | ||
} | ||
export declare class CallHierarchyFeature extends TextDocumentFeature<boolean | CallHierarchyOptions, CallHierarchyRegistrationOptions, CallHierarchyProvider> { | ||
constructor(client: BaseLanguageClient); | ||
fillClientCapabilities(cap: ClientCapabilities): void; | ||
initialize(cap: ServerCapabilities, documentSelector: DocumentSelector): void; | ||
protected registerLanguageProvider(options: CallHierarchyRegistrationOptions): Disposable; | ||
protected registerLanguageProvider(options: CallHierarchyRegistrationOptions): [Disposable, CallHierarchyProvider]; | ||
} | ||
export {}; |
@@ -144,9 +144,9 @@ /* -------------------------------------------------------------------------------------------- | ||
fillClientCapabilities(cap) { | ||
let capabilites = cap; | ||
let capability = ensure(ensure(capabilites, 'textDocument'), 'callHierarchy'); | ||
const capabilites = cap; | ||
const capability = ensure(ensure(capabilites, 'textDocument'), 'callHierarchy'); | ||
capability.dynamicRegistration = true; | ||
} | ||
initialize(cap, documentSelector) { | ||
let capabilities = cap; | ||
let [id, options] = this.getRegistration(documentSelector, capabilities.callHierarchyProvider); | ||
const capabilities = cap; | ||
const [id, options] = this.getRegistration(documentSelector, capabilities.callHierarchyProvider); | ||
if (!id || !options) { | ||
@@ -158,7 +158,7 @@ return; | ||
registerLanguageProvider(options) { | ||
let client = this._client; | ||
let provider = new CallHierarchyProvider(client); | ||
return vscode_1.languages.registerCallHierarchyProvider(options.documentSelector, provider); | ||
const client = this._client; | ||
const provider = new CallHierarchyProvider(client); | ||
return [vscode_1.languages.registerCallHierarchyProvider(options.documentSelector, provider), provider]; | ||
} | ||
} | ||
exports.CallHierarchyFeature = CallHierarchyFeature; |
@@ -1,3 +0,3 @@ | ||
import { TextDocumentChangeEvent, TextDocument, Disposable, OutputChannel, FileSystemWatcher as VFileSystemWatcher, DiagnosticCollection, Diagnostic as VDiagnostic, Uri, ProviderResult, CancellationToken, Position as VPosition, Location as VLocation, Range as VRange, CompletionItem as VCompletionItem, CompletionList as VCompletionList, SignatureHelp as VSignatureHelp, SignatureHelpContext as VSignatureHelpContext, Definition as VDefinition, DefinitionLink as VDefinitionLink, DocumentHighlight as VDocumentHighlight, SymbolInformation as VSymbolInformation, CodeActionContext as VCodeActionContext, Command as VCommand, CodeLens as VCodeLens, FormattingOptions as VFormattingOptions, TextEdit as VTextEdit, WorkspaceEdit as VWorkspaceEdit, Hover as VHover, CodeAction as VCodeAction, DocumentSymbol as VDocumentSymbol, DocumentLink as VDocumentLink, TextDocumentWillSaveEvent, WorkspaceFolder as VWorkspaceFolder, CompletionContext as VCompletionContext } from 'vscode'; | ||
import { Message, RPCMessageType, ResponseError, RequestType, RequestType0, RequestHandler, RequestHandler0, GenericRequestHandler, NotificationType, NotificationType0, NotificationHandler, NotificationHandler0, GenericNotificationHandler, MessageReader, MessageWriter, Trace, Event, ClientCapabilities, TextDocumentRegistrationOptions, InitializeParams, InitializeResult, InitializeError, ServerCapabilities, DocumentSelector, FileEvent, ProgressType, StaticRegistrationOptions } from 'vscode-languageserver-protocol'; | ||
import { TextDocumentChangeEvent, TextDocument, Disposable, OutputChannel, FileSystemWatcher as VFileSystemWatcher, DiagnosticCollection, Diagnostic as VDiagnostic, Uri, ProviderResult, CancellationToken, Position as VPosition, Location as VLocation, Range as VRange, CompletionItem as VCompletionItem, CompletionList as VCompletionList, SignatureHelp as VSignatureHelp, SignatureHelpContext as VSignatureHelpContext, Definition as VDefinition, DefinitionLink as VDefinitionLink, DocumentHighlight as VDocumentHighlight, SymbolInformation as VSymbolInformation, CodeActionContext as VCodeActionContext, Command as VCommand, CodeLens as VCodeLens, FormattingOptions as VFormattingOptions, TextEdit as VTextEdit, WorkspaceEdit as VWorkspaceEdit, Hover as VHover, CodeAction as VCodeAction, DocumentSymbol as VDocumentSymbol, DocumentLink as VDocumentLink, TextDocumentWillSaveEvent, WorkspaceFolder as VWorkspaceFolder, CompletionContext as VCompletionContext, CompletionItemProvider, HoverProvider, SignatureHelpProvider, DefinitionProvider, ReferenceProvider, DocumentHighlightProvider, CodeActionProvider, DocumentFormattingEditProvider, DocumentRangeFormattingEditProvider, OnTypeFormattingEditProvider, RenameProvider, DocumentLinkProvider, DocumentColorProvider, DeclarationProvider, FoldingRangeProvider, ImplementationProvider, SelectionRangeProvider, TypeDefinitionProvider, WorkspaceSymbolProvider } from 'vscode'; | ||
import { Message, RPCMessageType, ResponseError, RequestType, RequestType0, RequestHandler, RequestHandler0, GenericRequestHandler, NotificationType, NotificationType0, NotificationHandler, NotificationHandler0, GenericNotificationHandler, MessageReader, MessageWriter, Trace, Event, ClientCapabilities, TextDocumentRegistrationOptions, InitializeParams, InitializeResult, InitializeError, ServerCapabilities, DocumentSelector, DidOpenTextDocumentNotification, DidChangeTextDocumentNotification, DidCloseTextDocumentNotification, DidSaveTextDocumentNotification, WillSaveTextDocumentNotification, WillSaveTextDocumentWaitUntilRequest, FileEvent, CompletionRequest, HoverRequest, SignatureHelpRequest, DefinitionRequest, ReferencesRequest, DocumentHighlightRequest, WorkspaceSymbolRequest, CodeActionRequest, DocumentFormattingRequest, DocumentRangeFormattingRequest, DocumentOnTypeFormattingRequest, RenameRequest, DocumentLinkRequest, ProgressType, StaticRegistrationOptions, DocumentColorRequest, DeclarationRequest, FoldingRangeRequest, ImplementationRequest, SelectionRangeRequest, TypeDefinitionRequest, Proposed } from 'vscode-languageserver-protocol'; | ||
import { ColorProviderMiddleware } from './colorProvider'; | ||
@@ -97,21 +97,21 @@ import { ImplementationMiddleware } from './implementation'; | ||
export interface HandleDiagnosticsSignature { | ||
(uri: Uri, diagnostics: VDiagnostic[]): void; | ||
(this: void, uri: Uri, diagnostics: VDiagnostic[]): void; | ||
} | ||
export interface ProvideCompletionItemsSignature { | ||
(document: TextDocument, position: VPosition, context: VCompletionContext, token: CancellationToken): ProviderResult<VCompletionItem[] | VCompletionList>; | ||
(this: void, document: TextDocument, position: VPosition, context: VCompletionContext, token: CancellationToken): ProviderResult<VCompletionItem[] | VCompletionList>; | ||
} | ||
export interface ResolveCompletionItemSignature { | ||
(item: VCompletionItem, token: CancellationToken): ProviderResult<VCompletionItem>; | ||
(this: void, item: VCompletionItem, token: CancellationToken): ProviderResult<VCompletionItem>; | ||
} | ||
export interface ProvideHoverSignature { | ||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VHover>; | ||
(this: void, document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VHover>; | ||
} | ||
export interface ProvideSignatureHelpSignature { | ||
(document: TextDocument, position: VPosition, context: VSignatureHelpContext, token: CancellationToken): ProviderResult<VSignatureHelp>; | ||
(this: void, document: TextDocument, position: VPosition, context: VSignatureHelpContext, token: CancellationToken): ProviderResult<VSignatureHelp>; | ||
} | ||
export interface ProvideDefinitionSignature { | ||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDefinition | VDefinitionLink[]>; | ||
(this: void, document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDefinition | VDefinitionLink[]>; | ||
} | ||
export interface ProvideReferencesSignature { | ||
(document: TextDocument, position: VPosition, options: { | ||
(this: void, document: TextDocument, position: VPosition, options: { | ||
includeDeclaration: boolean; | ||
@@ -121,33 +121,33 @@ }, token: CancellationToken): ProviderResult<VLocation[]>; | ||
export interface ProvideDocumentHighlightsSignature { | ||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDocumentHighlight[]>; | ||
(this: void, document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDocumentHighlight[]>; | ||
} | ||
export interface ProvideDocumentSymbolsSignature { | ||
(document: TextDocument, token: CancellationToken): ProviderResult<VSymbolInformation[] | VDocumentSymbol[]>; | ||
(this: void, document: TextDocument, token: CancellationToken): ProviderResult<VSymbolInformation[] | VDocumentSymbol[]>; | ||
} | ||
export interface ProvideWorkspaceSymbolsSignature { | ||
(query: string, token: CancellationToken): ProviderResult<VSymbolInformation[]>; | ||
(this: void, query: string, token: CancellationToken): ProviderResult<VSymbolInformation[]>; | ||
} | ||
export interface ProvideCodeActionsSignature { | ||
(document: TextDocument, range: VRange, context: VCodeActionContext, token: CancellationToken): ProviderResult<(VCommand | VCodeAction)[]>; | ||
(this: void, document: TextDocument, range: VRange, context: VCodeActionContext, token: CancellationToken): ProviderResult<(VCommand | VCodeAction)[]>; | ||
} | ||
export interface ProvideCodeLensesSignature { | ||
(document: TextDocument, token: CancellationToken): ProviderResult<VCodeLens[]>; | ||
(this: void, document: TextDocument, token: CancellationToken): ProviderResult<VCodeLens[]>; | ||
} | ||
export interface ResolveCodeLensSignature { | ||
(codeLens: VCodeLens, token: CancellationToken): ProviderResult<VCodeLens>; | ||
(this: void, codeLens: VCodeLens, token: CancellationToken): ProviderResult<VCodeLens>; | ||
} | ||
export interface ProvideDocumentFormattingEditsSignature { | ||
(document: TextDocument, options: VFormattingOptions, token: CancellationToken): ProviderResult<VTextEdit[]>; | ||
(this: void, document: TextDocument, options: VFormattingOptions, token: CancellationToken): ProviderResult<VTextEdit[]>; | ||
} | ||
export interface ProvideDocumentRangeFormattingEditsSignature { | ||
(document: TextDocument, range: VRange, options: VFormattingOptions, token: CancellationToken): ProviderResult<VTextEdit[]>; | ||
(this: void, document: TextDocument, range: VRange, options: VFormattingOptions, token: CancellationToken): ProviderResult<VTextEdit[]>; | ||
} | ||
export interface ProvideOnTypeFormattingEditsSignature { | ||
(document: TextDocument, position: VPosition, ch: string, options: VFormattingOptions, token: CancellationToken): ProviderResult<VTextEdit[]>; | ||
(this: void, document: TextDocument, position: VPosition, ch: string, options: VFormattingOptions, token: CancellationToken): ProviderResult<VTextEdit[]>; | ||
} | ||
export interface ProvideRenameEditsSignature { | ||
(document: TextDocument, position: VPosition, newName: string, token: CancellationToken): ProviderResult<VWorkspaceEdit>; | ||
(this: void, document: TextDocument, position: VPosition, newName: string, token: CancellationToken): ProviderResult<VWorkspaceEdit>; | ||
} | ||
export interface PrepareRenameSignature { | ||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VRange | { | ||
(this: void, document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VRange | { | ||
range: VRange; | ||
@@ -158,9 +158,9 @@ placeholder: string; | ||
export interface ProvideDocumentLinksSignature { | ||
(document: TextDocument, token: CancellationToken): ProviderResult<VDocumentLink[]>; | ||
(this: void, document: TextDocument, token: CancellationToken): ProviderResult<VDocumentLink[]>; | ||
} | ||
export interface ResolveDocumentLinkSignature { | ||
(link: VDocumentLink, token: CancellationToken): ProviderResult<VDocumentLink>; | ||
(this: void, link: VDocumentLink, token: CancellationToken): ProviderResult<VDocumentLink>; | ||
} | ||
export interface ExecuteCommandSignature { | ||
(command: string, args: any[]): ProviderResult<any>; | ||
(this: void, command: string, args: any[]): ProviderResult<any>; | ||
} | ||
@@ -171,6 +171,6 @@ export interface NextSignature<P, R> { | ||
export interface DidChangeConfigurationSignature { | ||
(sections: string[] | undefined): void; | ||
(this: void, sections: string[] | undefined): void; | ||
} | ||
export interface DidChangeWatchedFileSignature { | ||
(event: FileEvent): void; | ||
(this: void, event: FileEvent): void; | ||
} | ||
@@ -335,6 +335,20 @@ export interface _WorkspaceMiddleware { | ||
} | ||
export declare abstract class TextDocumentFeature<PO, RO extends TextDocumentRegistrationOptions & PO> implements DynamicFeature<RO> { | ||
export interface NotificationFeature<T extends Function> { | ||
/** | ||
* Triggers the corresponding RPC method. | ||
*/ | ||
getProvider(document: TextDocument): { | ||
send: T; | ||
}; | ||
} | ||
export interface TextDocumentProviderFeature<T> { | ||
/** | ||
* Triggers the corresponding RPC method. | ||
*/ | ||
getProvider(textDocument: TextDocument): T; | ||
} | ||
export declare abstract class TextDocumentFeature<PO, RO extends TextDocumentRegistrationOptions & PO, PR> implements DynamicFeature<RO> { | ||
protected _client: BaseLanguageClient; | ||
private _message; | ||
protected _providers: Map<string, Disposable>; | ||
private _registrations; | ||
constructor(_client: BaseLanguageClient, _message: RPCMessageType); | ||
@@ -345,3 +359,3 @@ get messages(): RPCMessageType; | ||
register(message: RPCMessageType, data: RegistrationData<RO>): void; | ||
protected abstract registerLanguageProvider(options: RO): Disposable; | ||
protected abstract registerLanguageProvider(options: RO): [Disposable, PR]; | ||
unregister(id: string): void; | ||
@@ -355,3 +369,11 @@ dispose(): void; | ||
}) | undefined; | ||
getProvider(textDocument: TextDocument): PR; | ||
} | ||
export interface WorkspaceProviderFeature<PR> { | ||
getProviders(): PR[]; | ||
} | ||
export interface ProvideResolveFeature<T1 extends Function, T2 extends Function> { | ||
provide: T1; | ||
resolve: T2; | ||
} | ||
export interface MessageTransports { | ||
@@ -459,3 +481,28 @@ reader: MessageReader; | ||
registerFeature(feature: StaticFeature | DynamicFeature<any>): void; | ||
getDynamicFeature(message: RPCMessageType): DynamicFeature<any> | undefined; | ||
getFeature(request: typeof DidOpenTextDocumentNotification.method): DynamicFeature<TextDocumentRegistrationOptions> & NotificationFeature<(textDocument: TextDocument) => void>; | ||
getFeature(request: typeof DidChangeTextDocumentNotification.method): DynamicFeature<TextDocumentRegistrationOptions> & NotificationFeature<(textDocument: TextDocument) => void>; | ||
getFeature(request: typeof WillSaveTextDocumentNotification.method): DynamicFeature<TextDocumentRegistrationOptions> & NotificationFeature<(textDocument: TextDocument) => void>; | ||
getFeature(request: typeof WillSaveTextDocumentWaitUntilRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & NotificationFeature<(textDocument: TextDocument) => ProviderResult<VTextEdit[]>>; | ||
getFeature(request: typeof DidSaveTextDocumentNotification.method): DynamicFeature<TextDocumentRegistrationOptions> & NotificationFeature<(textDocument: TextDocument) => void>; | ||
getFeature(request: typeof DidCloseTextDocumentNotification.method): DynamicFeature<TextDocumentRegistrationOptions> & NotificationFeature<(textDocument: TextDocument) => void>; | ||
getFeature(request: typeof CompletionRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<CompletionItemProvider>; | ||
getFeature(request: typeof HoverRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<HoverProvider>; | ||
getFeature(request: typeof SignatureHelpRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<SignatureHelpProvider>; | ||
getFeature(request: typeof DefinitionRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DefinitionProvider>; | ||
getFeature(request: typeof ReferencesRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<ReferenceProvider>; | ||
getFeature(request: typeof DocumentHighlightRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentHighlightProvider>; | ||
getFeature(request: typeof CodeActionRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<CodeActionProvider>; | ||
getFeature(request: typeof DocumentFormattingRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentFormattingEditProvider>; | ||
getFeature(request: typeof DocumentRangeFormattingRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentRangeFormattingEditProvider>; | ||
getFeature(request: typeof DocumentOnTypeFormattingRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<OnTypeFormattingEditProvider>; | ||
getFeature(request: typeof RenameRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<RenameProvider>; | ||
getFeature(request: typeof DocumentLinkRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentLinkProvider>; | ||
getFeature(request: typeof DocumentColorRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DocumentColorProvider>; | ||
getFeature(request: typeof DeclarationRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<DeclarationProvider>; | ||
getFeature(request: typeof FoldingRangeRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<FoldingRangeProvider>; | ||
getFeature(request: typeof ImplementationRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<ImplementationProvider>; | ||
getFeature(request: typeof SelectionRangeRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<SelectionRangeProvider>; | ||
getFeature(request: typeof TypeDefinitionRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<TypeDefinitionProvider>; | ||
getFeature(request: typeof Proposed.CallHierarchyPrepareRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & TextDocumentProviderFeature<TypeDefinitionProvider>; | ||
getFeature(request: typeof WorkspaceSymbolRequest.method): DynamicFeature<TextDocumentRegistrationOptions> & WorkspaceProviderFeature<WorkspaceSymbolProvider>; | ||
protected registerBuiltinFeatures(): void; | ||
@@ -462,0 +509,0 @@ private fillInitializeParams; |
@@ -1,2 +0,2 @@ | ||
import { Disposable, TextDocument, ProviderResult, Range as VRange, Color as VColor, ColorPresentation as VColorPresentation, ColorInformation as VColorInformation } from 'vscode'; | ||
import { Disposable, TextDocument, ProviderResult, Range as VRange, Color as VColor, ColorPresentation as VColorPresentation, ColorInformation as VColorInformation, DocumentColorProvider } from 'vscode'; | ||
import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector } from 'vscode-languageserver-protocol'; | ||
@@ -21,7 +21,7 @@ import { TextDocumentFeature, BaseLanguageClient } from './client'; | ||
} | ||
export declare class ColorProviderFeature extends TextDocumentFeature<boolean | DocumentColorOptions, DocumentColorRegistrationOptions> { | ||
export declare class ColorProviderFeature extends TextDocumentFeature<boolean | DocumentColorOptions, DocumentColorRegistrationOptions, DocumentColorProvider> { | ||
constructor(client: BaseLanguageClient); | ||
fillClientCapabilities(capabilites: ClientCapabilities): void; | ||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void; | ||
protected registerLanguageProvider(options: DocumentColorRegistrationOptions): Disposable; | ||
protected registerLanguageProvider(options: DocumentColorRegistrationOptions): [Disposable, DocumentColorProvider]; | ||
private asColor; | ||
@@ -28,0 +28,0 @@ private asColorInformations; |
@@ -31,26 +31,17 @@ /* -------------------------------------------------------------------------------------------- | ||
registerLanguageProvider(options) { | ||
let client = this._client; | ||
let provideColorPresentations = (color, context, token) => { | ||
const requestParams = { | ||
color, | ||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(context.document), | ||
range: client.code2ProtocolConverter.asRange(context.range) | ||
}; | ||
return client.sendRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, requestParams, token).then(this.asColorPresentations.bind(this), (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
let provideDocumentColors = (document, token) => { | ||
const requestParams = { | ||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document) | ||
}; | ||
return client.sendRequest(vscode_languageserver_protocol_1.DocumentColorRequest.type, requestParams, token).then(this.asColorInformations.bind(this), (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
let middleware = client.clientOptions.middleware; | ||
return vscode_1.languages.registerColorProvider(options.documentSelector, { | ||
const provider = { | ||
provideColorPresentations: (color, context, token) => { | ||
const client = this._client; | ||
const provideColorPresentations = (color, context, token) => { | ||
const requestParams = { | ||
color, | ||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(context.document), | ||
range: client.code2ProtocolConverter.asRange(context.range) | ||
}; | ||
return client.sendRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, requestParams, token).then(this.asColorPresentations.bind(this), (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
const middleware = client.clientOptions.middleware; | ||
return middleware.provideColorPresentations | ||
@@ -61,2 +52,13 @@ ? middleware.provideColorPresentations(color, context, token, provideColorPresentations) | ||
provideDocumentColors: (document, token) => { | ||
const client = this._client; | ||
const provideDocumentColors = (document, token) => { | ||
const requestParams = { | ||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document) | ||
}; | ||
return client.sendRequest(vscode_languageserver_protocol_1.DocumentColorRequest.type, requestParams, token).then(this.asColorInformations.bind(this), (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
const middleware = client.clientOptions.middleware; | ||
return middleware.provideDocumentColors | ||
@@ -66,3 +68,4 @@ ? middleware.provideDocumentColors(document, token, provideDocumentColors) | ||
} | ||
}); | ||
}; | ||
return [vscode_1.languages.registerColorProvider(options.documentSelector, provider), provider]; | ||
} | ||
@@ -69,0 +72,0 @@ asColor(color) { |
@@ -1,2 +0,2 @@ | ||
import { Disposable, TextDocument, ProviderResult, Position as VPosition, Declaration as VDeclaration } from 'vscode'; | ||
import { Disposable, TextDocument, ProviderResult, Position as VPosition, Declaration as VDeclaration, DeclarationProvider } from 'vscode'; | ||
import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector } from 'vscode-languageserver-protocol'; | ||
@@ -6,3 +6,3 @@ import { TextDocumentFeature, BaseLanguageClient } from './client'; | ||
export interface ProvideDeclarationSignature { | ||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDeclaration>; | ||
(this: void, document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDeclaration>; | ||
} | ||
@@ -12,7 +12,7 @@ export interface DeclarationMiddleware { | ||
} | ||
export declare class DeclarationFeature extends TextDocumentFeature<boolean | DeclarationOptions, DeclarationRegistrationOptions> { | ||
export declare class DeclarationFeature extends TextDocumentFeature<boolean | DeclarationOptions, DeclarationRegistrationOptions, DeclarationProvider> { | ||
constructor(client: BaseLanguageClient); | ||
fillClientCapabilities(capabilites: ClientCapabilities): void; | ||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void; | ||
protected registerLanguageProvider(options: DeclarationRegistrationOptions): Disposable; | ||
protected registerLanguageProvider(options: DeclarationRegistrationOptions): [Disposable, DeclarationProvider]; | ||
} |
@@ -33,12 +33,12 @@ /* -------------------------------------------------------------------------------------------- | ||
registerLanguageProvider(options) { | ||
const client = this._client; | ||
const provideDeclaration = (document, position, token) => { | ||
return client.sendRequest(vscode_languageserver_protocol_1.DeclarationRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(client.protocol2CodeConverter.asDeclarationResult, (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.DeclarationRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
const middleware = client.clientOptions.middleware; | ||
return vscode_1.languages.registerDeclarationProvider(options.documentSelector, { | ||
const provider = { | ||
provideDeclaration: (document, position, token) => { | ||
const client = this._client; | ||
const provideDeclaration = (document, position, token) => { | ||
return client.sendRequest(vscode_languageserver_protocol_1.DeclarationRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(client.protocol2CodeConverter.asDeclarationResult, (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.DeclarationRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
const middleware = client.clientOptions.middleware; | ||
return middleware.provideDeclaration | ||
@@ -48,5 +48,6 @@ ? middleware.provideDeclaration(document, position, token, provideDeclaration) | ||
} | ||
}); | ||
}; | ||
return [vscode_1.languages.registerDeclarationProvider(options.documentSelector, provider), provider]; | ||
} | ||
} | ||
exports.DeclarationFeature = DeclarationFeature; |
@@ -1,2 +0,2 @@ | ||
import { Disposable, TextDocument, ProviderResult, FoldingRange as VFoldingRange, FoldingContext } from 'vscode'; | ||
import { Disposable, TextDocument, ProviderResult, FoldingRange as VFoldingRange, FoldingContext, FoldingRangeProvider } from 'vscode'; | ||
import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector } from 'vscode-languageserver-protocol'; | ||
@@ -6,3 +6,3 @@ import { TextDocumentFeature, BaseLanguageClient } from './client'; | ||
export interface ProvideFoldingRangeSignature { | ||
(document: TextDocument, context: FoldingContext, token: CancellationToken): ProviderResult<VFoldingRange[]>; | ||
(this: void, document: TextDocument, context: FoldingContext, token: CancellationToken): ProviderResult<VFoldingRange[]>; | ||
} | ||
@@ -12,9 +12,9 @@ export interface FoldingRangeProviderMiddleware { | ||
} | ||
export declare class FoldingRangeFeature extends TextDocumentFeature<boolean | FoldingRangeOptions, FoldingRangeRegistrationOptions> { | ||
export declare class FoldingRangeFeature extends TextDocumentFeature<boolean | FoldingRangeOptions, FoldingRangeRegistrationOptions, FoldingRangeProvider> { | ||
constructor(client: BaseLanguageClient); | ||
fillClientCapabilities(capabilites: ClientCapabilities): void; | ||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void; | ||
protected registerLanguageProvider(options: FoldingRangeRegistrationOptions): Disposable; | ||
protected registerLanguageProvider(options: FoldingRangeRegistrationOptions): [Disposable, FoldingRangeProvider]; | ||
private asFoldingRangeKind; | ||
private asFoldingRanges; | ||
} |
@@ -34,15 +34,15 @@ /* -------------------------------------------------------------------------------------------- | ||
registerLanguageProvider(options) { | ||
let client = this._client; | ||
let provideFoldingRanges = (document, _, token) => { | ||
const requestParams = { | ||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document) | ||
}; | ||
return client.sendRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, requestParams, token).then(this.asFoldingRanges.bind(this), (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
let middleware = client.clientOptions.middleware; | ||
return vscode_1.languages.registerFoldingRangeProvider(options.documentSelector, { | ||
provideFoldingRanges(document, context, token) { | ||
const provider = { | ||
provideFoldingRanges: (document, context, token) => { | ||
const client = this._client; | ||
const provideFoldingRanges = (document, _, token) => { | ||
const requestParams = { | ||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document) | ||
}; | ||
return client.sendRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, requestParams, token).then(this.asFoldingRanges.bind(this), (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
const middleware = client.clientOptions.middleware; | ||
return middleware.provideFoldingRanges | ||
@@ -52,3 +52,4 @@ ? middleware.provideFoldingRanges(document, context, token, provideFoldingRanges) | ||
} | ||
}); | ||
}; | ||
return [vscode_1.languages.registerFoldingRangeProvider(options.documentSelector, provider), provider]; | ||
} | ||
@@ -55,0 +56,0 @@ asFoldingRangeKind(kind) { |
@@ -1,2 +0,2 @@ | ||
import { Disposable, TextDocument, ProviderResult, Position as VPosition, Definition as VDefinition, DefinitionLink as VDefinitionLink } from 'vscode'; | ||
import { Disposable, TextDocument, ProviderResult, Position as VPosition, Definition as VDefinition, DefinitionLink as VDefinitionLink, ImplementationProvider } from 'vscode'; | ||
import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector } from 'vscode-languageserver-protocol'; | ||
@@ -6,3 +6,3 @@ import { TextDocumentFeature, BaseLanguageClient } from './client'; | ||
export interface ProvideImplementationSignature { | ||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDefinition | VDefinitionLink[]>; | ||
(this: void, document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDefinition | VDefinitionLink[]>; | ||
} | ||
@@ -12,7 +12,7 @@ export interface ImplementationMiddleware { | ||
} | ||
export declare class ImplementationFeature extends TextDocumentFeature<boolean | ImplementationOptions, ImplementationRegistrationOptions> { | ||
export declare class ImplementationFeature extends TextDocumentFeature<boolean | ImplementationOptions, ImplementationRegistrationOptions, ImplementationProvider> { | ||
constructor(client: BaseLanguageClient); | ||
fillClientCapabilities(capabilites: ClientCapabilities): void; | ||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void; | ||
protected registerLanguageProvider(options: ImplementationRegistrationOptions): Disposable; | ||
protected registerLanguageProvider(options: ImplementationRegistrationOptions): [Disposable, ImplementationProvider]; | ||
} |
@@ -33,12 +33,12 @@ /* -------------------------------------------------------------------------------------------- | ||
registerLanguageProvider(options) { | ||
let client = this._client; | ||
let provideImplementation = (document, position, token) => { | ||
return client.sendRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(client.protocol2CodeConverter.asDefinitionResult, (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
let middleware = client.clientOptions.middleware; | ||
return vscode_1.languages.registerImplementationProvider(options.documentSelector, { | ||
const provider = { | ||
provideImplementation: (document, position, token) => { | ||
const client = this._client; | ||
const provideImplementation = (document, position, token) => { | ||
return client.sendRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(client.protocol2CodeConverter.asDefinitionResult, (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
const middleware = client.clientOptions.middleware; | ||
return middleware.provideImplementation | ||
@@ -48,5 +48,6 @@ ? middleware.provideImplementation(document, position, token, provideImplementation) | ||
} | ||
}); | ||
}; | ||
return [vscode_1.languages.registerImplementationProvider(options.documentSelector, provider), provider]; | ||
} | ||
} | ||
exports.ImplementationFeature = ImplementationFeature; |
@@ -1,2 +0,2 @@ | ||
import { Disposable, TextDocument, ProviderResult, Position as VPosition, SelectionRange as VSelectionRange } from 'vscode'; | ||
import { Disposable, TextDocument, ProviderResult, Position as VPosition, SelectionRange as VSelectionRange, SelectionRangeProvider } from 'vscode'; | ||
import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector, SelectionRangeOptions } from 'vscode-languageserver-protocol'; | ||
@@ -6,3 +6,3 @@ import { TextDocumentFeature, BaseLanguageClient } from './client'; | ||
export interface ProvideSelectionRangeSignature { | ||
(document: TextDocument, positions: VPosition[], token: CancellationToken): ProviderResult<VSelectionRange[]>; | ||
(this: void, document: TextDocument, positions: VPosition[], token: CancellationToken): ProviderResult<VSelectionRange[]>; | ||
} | ||
@@ -12,7 +12,7 @@ export interface SelectionRangeProviderMiddleware { | ||
} | ||
export declare class SelectionRangeFeature extends TextDocumentFeature<boolean | SelectionRangeOptions, SelectionRangeRegistrationOptions> { | ||
export declare class SelectionRangeFeature extends TextDocumentFeature<boolean | SelectionRangeOptions, SelectionRangeRegistrationOptions, SelectionRangeProvider> { | ||
constructor(client: BaseLanguageClient); | ||
fillClientCapabilities(cap: ClientCapabilities): void; | ||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void; | ||
protected registerLanguageProvider(options: SelectionRangeRegistrationOptions): Disposable; | ||
protected registerLanguageProvider(options: SelectionRangeRegistrationOptions): [Disposable, SelectionRangeProvider]; | ||
} |
@@ -33,16 +33,16 @@ /* -------------------------------------------------------------------------------------------- | ||
registerLanguageProvider(options) { | ||
let client = this._client; | ||
let provideSelectionRanges = (document, positions, token) => { | ||
const requestParams = { | ||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document), | ||
positions: client.code2ProtocolConverter.asPositions(positions) | ||
}; | ||
return client.sendRequest(vscode_languageserver_protocol_1.SelectionRangeRequest.type, requestParams, token).then((ranges) => client.protocol2CodeConverter.asSelectionRanges(ranges), (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.SelectionRangeRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
let middleware = client.clientOptions.middleware; | ||
return vscode_1.languages.registerSelectionRangeProvider(options.documentSelector, { | ||
provideSelectionRanges(document, positions, token) { | ||
const provider = { | ||
provideSelectionRanges: (document, positions, token) => { | ||
const client = this._client; | ||
const provideSelectionRanges = (document, positions, token) => { | ||
const requestParams = { | ||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document), | ||
positions: client.code2ProtocolConverter.asPositions(positions) | ||
}; | ||
return client.sendRequest(vscode_languageserver_protocol_1.SelectionRangeRequest.type, requestParams, token).then((ranges) => client.protocol2CodeConverter.asSelectionRanges(ranges), (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.SelectionRangeRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
const middleware = client.clientOptions.middleware; | ||
return middleware.provideSelectionRanges | ||
@@ -52,5 +52,6 @@ ? middleware.provideSelectionRanges(document, positions, token, provideSelectionRanges) | ||
} | ||
}); | ||
}; | ||
return [vscode_1.languages.registerSelectionRangeProvider(options.documentSelector, provider), provider]; | ||
} | ||
} | ||
exports.SelectionRangeFeature = SelectionRangeFeature; |
@@ -1,2 +0,2 @@ | ||
import { Disposable, TextDocument, ProviderResult, Position as VPosition, Definition as VDefinition, DefinitionLink as VDefinitionLink } from 'vscode'; | ||
import { Disposable, TextDocument, ProviderResult, Position as VPosition, Definition as VDefinition, DefinitionLink as VDefinitionLink, TypeDefinitionProvider } from 'vscode'; | ||
import { ClientCapabilities, CancellationToken, ServerCapabilities, DocumentSelector } from 'vscode-languageserver-protocol'; | ||
@@ -6,3 +6,3 @@ import { TextDocumentFeature, BaseLanguageClient } from './client'; | ||
export interface ProvideTypeDefinitionSignature { | ||
(document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDefinition | VDefinitionLink[]>; | ||
(this: void, document: TextDocument, position: VPosition, token: CancellationToken): ProviderResult<VDefinition | VDefinitionLink[]>; | ||
} | ||
@@ -12,7 +12,7 @@ export interface TypeDefinitionMiddleware { | ||
} | ||
export declare class TypeDefinitionFeature extends TextDocumentFeature<boolean | TypeDefinitionOptions, TypeDefinitionRegistrationOptions> { | ||
export declare class TypeDefinitionFeature extends TextDocumentFeature<boolean | TypeDefinitionOptions, TypeDefinitionRegistrationOptions, TypeDefinitionProvider> { | ||
constructor(client: BaseLanguageClient); | ||
fillClientCapabilities(capabilites: ClientCapabilities): void; | ||
initialize(capabilities: ServerCapabilities, documentSelector: DocumentSelector): void; | ||
protected registerLanguageProvider(options: TypeDefinitionRegistrationOptions): Disposable; | ||
protected registerLanguageProvider(options: TypeDefinitionRegistrationOptions): [Disposable, TypeDefinitionProvider]; | ||
} |
@@ -34,12 +34,12 @@ /* -------------------------------------------------------------------------------------------- | ||
registerLanguageProvider(options) { | ||
let client = this._client; | ||
let provideTypeDefinition = (document, position, token) => { | ||
return client.sendRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(client.protocol2CodeConverter.asDefinitionResult, (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
let middleware = client.clientOptions.middleware; | ||
return vscode_1.languages.registerTypeDefinitionProvider(options.documentSelector, { | ||
const provider = { | ||
provideTypeDefinition: (document, position, token) => { | ||
const client = this._client; | ||
const provideTypeDefinition = (document, position, token) => { | ||
return client.sendRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, client.code2ProtocolConverter.asTextDocumentPositionParams(document, position), token).then(client.protocol2CodeConverter.asDefinitionResult, (error) => { | ||
client.logFailedRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, error); | ||
return Promise.resolve(null); | ||
}); | ||
}; | ||
const middleware = client.clientOptions.middleware; | ||
return middleware.provideTypeDefinition | ||
@@ -49,5 +49,6 @@ ? middleware.provideTypeDefinition(document, position, token, provideTypeDefinition) | ||
} | ||
}); | ||
}; | ||
return [vscode_1.languages.registerTypeDefinitionProvider(options.documentSelector, provider), provider]; | ||
} | ||
} | ||
exports.TypeDefinitionFeature = TypeDefinitionFeature; |
{ | ||
"name": "vscode-languageclient", | ||
"description": "VSCode Language client implementation", | ||
"version": "6.0.0-next.8", | ||
"version": "6.0.0-next.9", | ||
"author": "Microsoft Corporation", | ||
@@ -27,3 +27,3 @@ "license": "MIT", | ||
"semver": "^6.3.0", | ||
"vscode-languageserver-protocol": "^3.15.0-next.13" | ||
"vscode-languageserver-protocol": "^3.15.0-next.14" | ||
}, | ||
@@ -30,0 +30,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
310787
6491