From 29fe3f317ffa513746f456ee6026796638ada21a Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 16 Nov 2018 10:10:33 +0100 Subject: [PATCH] make declaration provider api stable, #62483 --- src/vs/vscode.d.ts | 37 +++++++++++++++++++++++++++++++++++++ src/vs/vscode.proposed.d.ts | 36 ------------------------------------ 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 6b7d3b8f484..1bd37d77e13 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -2272,6 +2272,30 @@ declare module 'vscode' { provideTypeDefinition(document: TextDocument, position: Position, token: CancellationToken): ProviderResult; } + /** + * The declaration of a symbol representation as one or many [locations](#Location) + * or [location links][#LocationLink]. + */ + export type Declaration = Location | Location[] | LocationLink[]; + + /** + * The declaration provider interface defines the contract between extensions and + * the go to declaration feature. + */ + export interface DeclarationProvider { + + /** + * Provide the declaration of the symbol at the given position and document. + * + * @param document The document in which the command was invoked. + * @param position The position at which the command was invoked. + * @param token A cancellation token. + * @return A declaration or a thenable that resolves to such. The lack of a result can be + * signaled by returning `undefined` or `null`. + */ + provideDeclaration(document: TextDocument, position: Position, token: CancellationToken): ProviderResult; + } + /** * The MarkdownString represents human readable text that supports formatting via the * markdown syntax. Standard markdown is supported, also tables, but no embedded html. @@ -7712,6 +7736,19 @@ declare module 'vscode' { */ export function registerTypeDefinitionProvider(selector: DocumentSelector, provider: TypeDefinitionProvider): Disposable; + /** + * Register a declaration provider. + * + * Multiple providers can be registered for a language. In that case providers are asked in + * parallel and the results are merged. A failing provider (rejected promise or exception) will + * not cause a failure of the whole operation. + * + * @param selector A selector that defines the documents this provider is applicable to. + * @param provider A declaration provider. + * @return A [disposable](#Disposable) that unregisters this provider when being disposed. + */ + export function registerDeclarationProvider(selector: DocumentSelector, provider: DeclarationProvider): Disposable; + /** * Register a hover provider. * diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 045e149fa2f..31bbbe43cb1 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -20,42 +20,6 @@ declare module 'vscode' { export function sampleFunction(): Thenable; } - //#region Joh - - /** - * The declaration of a symbol representation as one or many [locations](#Location) - * or [location links][#LocationLink]. - */ - export type Declaration = Location | Location[] | LocationLink[]; - - /** - * The declaration provider interface defines the contract between extensions and - * the go to declaration feature. - */ - export interface DeclarationProvider { - - /** - * Provide the declaration of the symbol at the given position and document. - * - * @param document The document in which the command was invoked. - * @param position The position at which the command was invoked. - * @param token A cancellation token. - * @return A declaration or a thenable that resolves to such. The lack of a result can be - * signaled by returning `undefined` or `null`. - */ - provideDeclaration(document: TextDocument, position: Position, token: CancellationToken): ProviderResult; - } - - export namespace languages { - /** - * - * @param selector - * @param provider - */ - export function registerDeclarationProvider(selector: DocumentSelector, provider: DeclarationProvider): Disposable; - } - //#endregion - //#region Joh - https://github.com/Microsoft/vscode/issues/57093 /**