Skip to content

Commit

Permalink
finalize quickpick API
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerLeonhardt committed Jan 21, 2022
1 parent 02606cd commit e15397d
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 33 deletions.
1 change: 0 additions & 1 deletion extensions/typescript-language-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"enabledApiProposals": [
"inlayHints",
"languageStatus",
"quickPickSeparators",
"resolvers",
"workspaceTrust"
],
Expand Down
1 change: 0 additions & 1 deletion extensions/typescript-language-features/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.inlayHints.d.ts",
"../../src/vscode-dts/vscode.proposed.languageStatus.d.ts",
"../../src/vscode-dts/vscode.proposed.quickPickSeparators.d.ts",
"../../src/vscode-dts/vscode.proposed.resolvers.d.ts",
"../../src/vscode-dts/vscode.proposed.workspaceTrust.d.ts",
]
Expand Down
4 changes: 0 additions & 4 deletions src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return <Thenable<any>>extHostMessageService.showMessage(extension, Severity.Error, message, rest[0], <Array<string | vscode.MessageItem>>rest.slice(1));
},
showQuickPick(items: any, options?: vscode.QuickPickOptions, token?: vscode.CancellationToken): any {
// TODO: remove this once quickPickSeparators has been finalized.
if (Array.isArray(items) && items.some((item) => item.kind === extHostTypes.QuickPickItemKind.Separator)) {
checkProposedApiEnabled(extension, 'quickPickSeparators');
}
return extHostQuickOpen.showQuickPick(items, options, token);
},
showWorkspaceFolderPick(options?: vscode.WorkspaceFolderPickOptions) {
Expand Down
8 changes: 1 addition & 7 deletions src/vs/workbench/api/common/extHostQuickOpen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensio
import { coalesce } from 'vs/base/common/arrays';
import Severity from 'vs/base/common/severity';
import { ThemeIcon as ThemeIconUtils } from 'vs/platform/theme/common/themeService';
import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';

export type Item = string | QuickPickItem;

Expand Down Expand Up @@ -522,8 +521,7 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx
private readonly _onDidChangeSelectionEmitter = new Emitter<T[]>();
private readonly _onDidTriggerItemButtonEmitter = new Emitter<QuickPickItemButtonEvent<T>>();

// TODO: revert this change once quickPickSeparators has been finalized.
constructor(private readonly extension: IExtensionDescription, onDispose: () => void) {
constructor(extension: IExtensionDescription, onDispose: () => void) {
super(extension.identifier, onDispose);
this._disposables.push(
this._onDidChangeActiveEmitter,
Expand All @@ -538,10 +536,6 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx
}

set items(items: T[]) {
if (items.some((item) => item.kind !== undefined)) {
checkProposedApiEnabled(this.extension, 'quickPickSeparators');
}

this._items = items.slice();
this._handlesToItems.clear();
this._itemsToHandles.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2962,7 +2962,7 @@ export class QuickInputButtons {

export enum QuickPickItemKind {
Separator = -1,
Default = 1,
Default = 0,
}

export enum ExtensionKind {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const allApiProposals = Object.freeze({
notebookMessaging: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMessaging.d.ts',
notebookMime: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMime.d.ts',
portsAttributes: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.portsAttributes.d.ts',
quickPickSeparators: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickSeparators.d.ts',
quickPickSortByLabel: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts',
resolvers: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.resolvers.d.ts',
scmActionButton: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmActionButton.d.ts',
Expand Down
7 changes: 7 additions & 0 deletions src/vscode-dts/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1638,6 +1638,11 @@ declare module 'vscode' {
provideTextDocumentContent(uri: Uri, token: CancellationToken): ProviderResult<string>;
}

export enum QuickPickItemKind {
Separator = -1,
Default = 0,
}

/**
* Represents an item that can be selected from
* a list of items.
Expand All @@ -1650,6 +1655,8 @@ declare module 'vscode' {
*/
label: string;

kind?: QuickPickItemKind;

/**
* A human-readable string which is rendered less prominent in the same line. Supports rendering of
* {@link ThemeIcon theme icons} via the `$(<name>)`-syntax.
Expand Down
18 changes: 0 additions & 18 deletions src/vscode-dts/vscode.proposed.quickPickSeparators.d.ts

This file was deleted.

0 comments on commit e15397d

Please sign in to comment.