mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Merge pull request #63150 from YisraelV/customNameForOutline
custom name when there are multiple outline providers - feature request #62839
This commit is contained in:
commit
988f7683df
11
src/vs/vscode.d.ts
vendored
11
src/vs/vscode.d.ts
vendored
|
@ -2611,6 +2611,14 @@ declare module 'vscode' {
|
|||
provideDocumentSymbols(document: TextDocument, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
|
||||
}
|
||||
|
||||
export interface DocumentSymbolProviderMetadata {
|
||||
/**
|
||||
* If there is more than one outline provider, this name will be used in the outline tree to
|
||||
* distinguish between them.
|
||||
*/
|
||||
displayName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The workspace symbol provider interface defines the contract between extensions and
|
||||
* the [symbol search](https://code.visualstudio.com/docs/editor/editingevolved#_open-symbol-by-name)-feature.
|
||||
|
@ -7791,9 +7799,10 @@ declare module 'vscode' {
|
|||
*
|
||||
* @param selector A selector that defines the documents this provider is applicable to.
|
||||
* @param provider A document symbol provider.
|
||||
* @param metaData metadata about the provider
|
||||
* @return A [disposable](#Disposable) that unregisters this provider when being disposed.
|
||||
*/
|
||||
export function registerDocumentSymbolProvider(selector: DocumentSelector, provider: DocumentSymbolProvider): Disposable;
|
||||
export function registerDocumentSymbolProvider(selector: DocumentSelector, provider: DocumentSymbolProvider, metaData?: DocumentSymbolProviderMetadata): Disposable;
|
||||
|
||||
/**
|
||||
* Register a workspace symbol provider.
|
||||
|
|
|
@ -320,8 +320,8 @@ export function createApiFactory(
|
|||
registerRenameProvider(selector: vscode.DocumentSelector, provider: vscode.RenameProvider): vscode.Disposable {
|
||||
return extHostLanguageFeatures.registerRenameProvider(extension, checkSelector(selector), provider);
|
||||
},
|
||||
registerDocumentSymbolProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentSymbolProvider): vscode.Disposable {
|
||||
return extHostLanguageFeatures.registerDocumentSymbolProvider(extension, checkSelector(selector), provider);
|
||||
registerDocumentSymbolProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentSymbolProvider, metadata?: vscode.DocumentSymbolProviderMetadata): vscode.Disposable {
|
||||
return extHostLanguageFeatures.registerDocumentSymbolProvider(extension, checkSelector(selector), provider, metadata);
|
||||
},
|
||||
registerWorkspaceSymbolProvider(provider: vscode.WorkspaceSymbolProvider): vscode.Disposable {
|
||||
return extHostLanguageFeatures.registerWorkspaceSymbolProvider(extension, provider);
|
||||
|
|
|
@ -973,9 +973,10 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
|
|||
|
||||
// --- outline
|
||||
|
||||
registerDocumentSymbolProvider(extension: IExtensionDescription, selector: vscode.DocumentSelector, provider: vscode.DocumentSymbolProvider): vscode.Disposable {
|
||||
registerDocumentSymbolProvider(extension: IExtensionDescription, selector: vscode.DocumentSelector, provider: vscode.DocumentSymbolProvider, metadata?: vscode.DocumentSymbolProviderMetadata): vscode.Disposable {
|
||||
const handle = this._addNewAdapter(new OutlineAdapter(this._documents, provider), extension);
|
||||
this._proxy.$registerOutlineSupport(handle, this._transformDocumentSelector(selector), extension ? extension.displayName || extension.name : undefined);
|
||||
const displayName = (metadata && metadata.displayName) || (extension && (extension.displayName || extension.name)) || undefined;
|
||||
this._proxy.$registerOutlineSupport(handle, this._transformDocumentSelector(selector), displayName);
|
||||
return this._createDisposable(handle);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue