mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
joh/issue152834 (#153298)
* update sample * dynamically alias `ms-vscode.references-view` onto `vscode.references-view`
This commit is contained in:
parent
1df4b3ceb8
commit
9b1c6cb3ff
|
@ -6,14 +6,14 @@
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface describes the shape for the references viewlet API. It consists
|
* This interface describes the shape for the references viewlet API. It consists
|
||||||
* of a single `setInput` function which must be called with a full implementation
|
* of a single `setInput` function which must be called with a full implementation
|
||||||
* of the `SymbolTreeInput`-interface. To acquire this API use the default mechanics, e.g:
|
* of the `SymbolTreeInput`-interface. To acquire this API use the default mechanics, e.g:
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* // get references viewlet API
|
* // get references viewlet API
|
||||||
* const api = await vscode.extensions.getExtension<SymbolTree>('ms-vscode.references-view').activate();
|
* const api = await vscode.extensions.getExtension<SymbolTree>('vscode.references-view').activate();
|
||||||
*
|
*
|
||||||
* // instantiate and set input which updates the view
|
* // instantiate and set input which updates the view
|
||||||
* const myInput: SymbolTreeInput<MyItems> = ...
|
* const myInput: SymbolTreeInput<MyItems> = ...
|
||||||
* api.setInput(myInput)
|
* api.setInput(myInput)
|
||||||
|
@ -22,8 +22,8 @@ import * as vscode from 'vscode';
|
||||||
export interface SymbolTree {
|
export interface SymbolTree {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the contents of the references viewlet.
|
* Set the contents of the references viewlet.
|
||||||
*
|
*
|
||||||
* @param input A symbol tree input object
|
* @param input A symbol tree input object
|
||||||
*/
|
*/
|
||||||
setInput(input: SymbolTreeInput<unknown>): void;
|
setInput(input: SymbolTreeInput<unknown>): void;
|
||||||
|
@ -31,7 +31,7 @@ export interface SymbolTree {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A symbol tree input is the entry point for populating the references viewlet.
|
* A symbol tree input is the entry point for populating the references viewlet.
|
||||||
* Inputs must be anchored at a code location, they must have a title, and they
|
* Inputs must be anchored at a code location, they must have a title, and they
|
||||||
* must resolve to a model.
|
* must resolve to a model.
|
||||||
*/
|
*/
|
||||||
export interface SymbolTreeInput<T> {
|
export interface SymbolTreeInput<T> {
|
||||||
|
@ -54,17 +54,17 @@ export interface SymbolTreeInput<T> {
|
||||||
readonly location: vscode.Location;
|
readonly location: vscode.Location;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve this input to a model that contains the actual data. When there are no result
|
* Resolve this input to a model that contains the actual data. When there are no result
|
||||||
* than `undefined` or `null` should be returned.
|
* than `undefined` or `null` should be returned.
|
||||||
*/
|
*/
|
||||||
resolve(): vscode.ProviderResult<SymbolTreeModel<T>>;
|
resolve(): vscode.ProviderResult<SymbolTreeModel<T>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called when re-running from history. The symbols tree has tracked
|
* This function is called when re-running from history. The symbols tree has tracked
|
||||||
* the original location of this input and that is now passed to this input. The
|
* the original location of this input and that is now passed to this input. The
|
||||||
* implementation of this function should return a clone where the `location`-property
|
* implementation of this function should return a clone where the `location`-property
|
||||||
* uses the provided `location`
|
* uses the provided `location`
|
||||||
*
|
*
|
||||||
* @param location The location at which the new input should be anchored.
|
* @param location The location at which the new input should be anchored.
|
||||||
* @returns A new input which location is anchored at the position.
|
* @returns A new input which location is anchored at the position.
|
||||||
*/
|
*/
|
||||||
|
@ -94,7 +94,7 @@ export interface SymbolTreeModel<T> {
|
||||||
navigation?: SymbolItemNavigation<T>;
|
navigation?: SymbolItemNavigation<T>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional support for editor highlights. WHen implemented, the editor will highlight
|
* Optional support for editor highlights. WHen implemented, the editor will highlight
|
||||||
* symbol ranges in the source code.
|
* symbol ranges in the source code.
|
||||||
*/
|
*/
|
||||||
highlights?: SymbolItemEditorHighlights<T>;
|
highlights?: SymbolItemEditorHighlights<T>;
|
||||||
|
|
|
@ -92,6 +92,7 @@ import { ExtHostInteractive } from 'vs/workbench/api/common/extHostInteractive';
|
||||||
import { combinedDisposable } from 'vs/base/common/lifecycle';
|
import { combinedDisposable } from 'vs/base/common/lifecycle';
|
||||||
import { checkProposedApiEnabled, ExtensionIdentifierSet, isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
|
import { checkProposedApiEnabled, ExtensionIdentifierSet, isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
|
||||||
import { DebugConfigurationProviderTriggerKind } from 'vs/workbench/contrib/debug/common/debug';
|
import { DebugConfigurationProviderTriggerKind } from 'vs/workbench/contrib/debug/common/debug';
|
||||||
|
import { equalsIgnoreCase } from 'vs/base/common/strings';
|
||||||
|
|
||||||
export interface IExtensionRegistries {
|
export interface IExtensionRegistries {
|
||||||
mine: ExtensionDescriptionRegistry;
|
mine: ExtensionDescriptionRegistry;
|
||||||
|
@ -392,6 +393,11 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||||
|
|
||||||
const extensions: typeof vscode.extensions = {
|
const extensions: typeof vscode.extensions = {
|
||||||
getExtension(extensionId: string, includeFromDifferentExtensionHosts?: boolean): vscode.Extension<any> | undefined {
|
getExtension(extensionId: string, includeFromDifferentExtensionHosts?: boolean): vscode.Extension<any> | undefined {
|
||||||
|
if (equalsIgnoreCase(extensionId, 'ms-vscode.references-view')) {
|
||||||
|
extHostApiDeprecation.report(`The extension 'ms-vscode.references-view' has been renamed.`, extension, `Use 'vscode.references-view' instead.`);
|
||||||
|
extensionId = 'vscode.references-view';
|
||||||
|
}
|
||||||
|
|
||||||
if (!isProposedApiEnabled(extension, 'extensionsAny')) {
|
if (!isProposedApiEnabled(extension, 'extensionsAny')) {
|
||||||
includeFromDifferentExtensionHosts = false;
|
includeFromDifferentExtensionHosts = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue