make declaration provider api stable, #62483

This commit is contained in:
Johannes Rieken 2018-11-16 10:10:33 +01:00
parent 6e44473c11
commit 29fe3f317f
2 changed files with 37 additions and 36 deletions

37
src/vs/vscode.d.ts vendored
View file

@ -2272,6 +2272,30 @@ declare module 'vscode' {
provideTypeDefinition(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
}
/**
* 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<Declaration>;
}
/**
* 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.
*

View file

@ -20,42 +20,6 @@ declare module 'vscode' {
export function sampleFunction(): Thenable<any>;
}
//#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<Declaration>;
}
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
/**