move TypeHierarchy-API to stable, https://github.com/microsoft/vscode/issues/15533

上级 1344e7ea
......@@ -4767,6 +4767,104 @@ declare module 'vscode' {
provideCallHierarchyOutgoingCalls(item: CallHierarchyItem, token: CancellationToken): ProviderResult<CallHierarchyOutgoingCall[]>;
}
/**
* Represents an item of a type hierarchy, like a class or an interface.
*/
export class TypeHierarchyItem {
/**
* The name of this item.
*/
name: string;
/**
* The kind of this item.
*/
kind: SymbolKind;
/**
* Tags for this item.
*/
tags?: ReadonlyArray<SymbolTag>;
/**
* More detail for this item, e.g. the signature of a function.
*/
detail?: string;
/**
* The resource identifier of this item.
*/
uri: Uri;
/**
* The range enclosing this symbol not including leading/trailing whitespace
* but everything else, e.g. comments and code.
*/
range: Range;
/**
* The range that should be selected and revealed when this symbol is being
* picked, e.g. the name of a class. Must be contained by the {@link TypeHierarchyItem.range range}-property.
*/
selectionRange: Range;
/**
* Creates a new type hierarchy item.
*
* @param kind The kind of the item.
* @param name The name of the item.
* @param detail The details of the item.
* @param uri The Uri of the item.
* @param range The whole range of the item.
* @param selectionRange The selection range of the item.
*/
constructor(kind: SymbolKind, name: string, detail: string, uri: Uri, range: Range, selectionRange: Range);
}
/**
* The type hierarchy provider interface describes the contract between extensions
* and the type hierarchy feature.
*/
export interface TypeHierarchyProvider {
/**
* Bootstraps type hierarchy by returning the item that is denoted by the given document
* and position. This item will be used as entry into the type graph. Providers should
* return `undefined` or `null` when there is no item at the given location.
*
* @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.
* @returns One or multiple type hierarchy items or a thenable that resolves to such. The lack of a result can be
* signaled by returning `undefined`, `null`, or an empty array.
*/
prepareTypeHierarchy(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<TypeHierarchyItem | TypeHierarchyItem[]>;
/**
* Provide all supertypes for an item, e.g all types from which a type is derived/inherited. In graph terms this describes directed
* and annotated edges inside the type graph, e.g the given item is the starting node and the result is the nodes
* that can be reached.
*
* @param item The hierarchy item for which super types should be computed.
* @param token A cancellation token.
* @returns A set of direct supertypes or a thenable that resolves to such. The lack of a result can be
* signaled by returning `undefined` or `null`.
*/
provideTypeHierarchySupertypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;
/**
* Provide all subtypes for an item, e.g all types which are derived/inherited from the given item. In
* graph terms this describes directed and annotated edges inside the type graph, e.g the given item is the starting
* node and the result is the nodes that can be reached.
*
* @param item The hierarchy item for which subtypes should be computed.
* @param token A cancellation token.
* @returns A set of direct subtypes or a thenable that resolves to such. The lack of a result can be
* signaled by returning `undefined` or `null`.
*/
provideTypeHierarchySubtypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;
}
/**
* Represents a list of ranges that can be edited together along with a word pattern to describe valid range contents.
*/
......@@ -11520,6 +11618,15 @@ declare module 'vscode' {
*/
export function registerCallHierarchyProvider(selector: DocumentSelector, provider: CallHierarchyProvider): Disposable;
/**
* Register a type hierarchy provider.
*
* @param selector A selector that defines the documents this provider is applicable to.
* @param provider A type hierarchy provider.
* @return {@link Disposable Disposable} that unregisters this provider when being disposed.
*/
export function registerTypeHierarchyProvider(selector: DocumentSelector, provider: TypeHierarchyProvider): Disposable;
/**
* Register a linked editing range provider.
*
......
......@@ -2816,119 +2816,6 @@ declare module 'vscode' {
//#endregion
//#region https://github.com/microsoft/vscode/issues/15533 --- Type hierarchy --- @eskibear
/**
* Represents an item of a type hierarchy, like a class or an interface.
*/
export class TypeHierarchyItem {
/**
* The name of this item.
*/
name: string;
/**
* The kind of this item.
*/
kind: SymbolKind;
/**
* Tags for this item.
*/
tags?: ReadonlyArray<SymbolTag>;
/**
* More detail for this item, e.g. the signature of a function.
*/
detail?: string;
/**
* The resource identifier of this item.
*/
uri: Uri;
/**
* The range enclosing this symbol not including leading/trailing whitespace
* but everything else, e.g. comments and code.
*/
range: Range;
/**
* The range that should be selected and revealed when this symbol is being
* picked, e.g. the name of a class. Must be contained by the {@link TypeHierarchyItem.range range}-property.
*/
selectionRange: Range;
/**
* Creates a new type hierarchy item.
*
* @param kind The kind of the item.
* @param name The name of the item.
* @param detail The details of the item.
* @param uri The Uri of the item.
* @param range The whole range of the item.
* @param selectionRange The selection range of the item.
*/
constructor(kind: SymbolKind, name: string, detail: string, uri: Uri, range: Range, selectionRange: Range);
}
/**
* The type hierarchy provider interface describes the contract between extensions
* and the type hierarchy feature.
*/
export interface TypeHierarchyProvider {
/**
* Bootstraps type hierarchy by returning the item that is denoted by the given document
* and position. This item will be used as entry into the type graph. Providers should
* return `undefined` or `null` when there is no item at the given location.
*
* @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.
* @returns One or multiple type hierarchy items or a thenable that resolves to such. The lack of a result can be
* signaled by returning `undefined`, `null`, or an empty array.
*/
prepareTypeHierarchy(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<TypeHierarchyItem | TypeHierarchyItem[]>;
/**
* Provide all supertypes for an item, e.g all types from which a type is derived/inherited. In graph terms this describes directed
* and annotated edges inside the type graph, e.g the given item is the starting node and the result is the nodes
* that can be reached.
*
* @param item The hierarchy item for which super types should be computed.
* @param token A cancellation token.
* @returns A set of supertypes or a thenable that resolves to such. The lack of a result can be
* signaled by returning `undefined` or `null`.
*/
provideTypeHierarchySupertypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;
/**
* Provide all subtypes for an item, e.g all types which are derived/inherited from the given item. In
* graph terms this describes directed and annotated edges inside the type graph, e.g the given item is the starting
* node and the result is the nodes that can be reached.
*
* @param item The hierarchy item for which subtypes should be computed.
* @param token A cancellation token.
* @returns A set of subtypes or a thenable that resolves to such. The lack of a result can be
* signaled by returning `undefined` or `null`.
*/
provideTypeHierarchySubtypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;
}
export namespace languages {
/**
* Register a type hierarchy provider.
*
* @param selector A selector that defines the documents this provider is applicable to.
* @param provider A type hierarchy provider.
* @return {@link Disposable Disposable} that unregisters this provider when being disposed.
*/
export function registerTypeHierarchyProvider(selector: DocumentSelector, provider: TypeHierarchyProvider): Disposable;
}
//#endregion
//#region https://github.com/microsoft/vscode/issues/129037
enum LanguageStatusSeverity {
......
......@@ -495,6 +495,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
registerCallHierarchyProvider(selector: vscode.DocumentSelector, provider: vscode.CallHierarchyProvider): vscode.Disposable {
return extHostLanguageFeatures.registerCallHierarchyProvider(extension, selector, provider);
},
registerTypeHierarchyProvider(selector: vscode.DocumentSelector, provider: vscode.TypeHierarchyProvider): vscode.Disposable {
return extHostLanguageFeatures.registerTypeHierarchyProvider(extension, selector, provider);
},
setLanguageConfiguration: (language: string, configuration: vscode.LanguageConfiguration): vscode.Disposable => {
return extHostLanguageFeatures.setLanguageConfiguration(extension, language, configuration);
},
......@@ -506,10 +509,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
checkProposedApiEnabled(extension);
return extHostLanguageFeatures.registerInlayHintsProvider(extension, selector, provider);
},
registerTypeHierarchyProvider(selector: vscode.DocumentSelector, provider: vscode.TypeHierarchyProvider): vscode.Disposable {
checkProposedApiEnabled(extension);
return extHostLanguageFeatures.registerTypeHierarchyProvider(extension, selector, provider);
},
createLanguageStatusItem(id: string, selector: vscode.DocumentSelector): vscode.LanguageStatusItem {
checkProposedApiEnabled(extension);
return extHostLanguages.createLanguageStatusItem(extension, id, selector);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册