Refs: #74967
Complexity: 4
Create Issue
In this milestone, we've introduced the highly anticipated QuickPick Separators into the API.
API definition:
|
// https://github.com/microsoft/vscode/issues/74967 |
|
|
|
export enum QuickPickItemKind { |
|
Default = 1, |
|
Separator = 2, |
|
} |
|
|
|
export interface QuickPickItem { |
|
kind?: QuickPickItemKind |
|
} |
|
} |
When you set the kind to Separator on a QuickPickItem, that QPI will be treated like a separator. Here's an example:
const result = await window.showQuickPick([
{
label: 'APIs',
kind: QuickPickItemKind.Separator
},
{
label: 'showQuickPick',
},
{
label: 'showInputBox',
},
{
label: 'createQuickPick',
},
{
label: 'createInputBox',
},
{
label: 'Types',
kind: QuickPickItemKind.Separator
},
{
label: 'QuickPickItemKind',
},
{
label: 'QuickInputButton',
},
{
label: 'QuickQuick',
},
{
label: 'InputBox',
},
]);
window.showInformationMessage(`You selected: ${result?.label ?? 'nothing'}`);
or the long form:
const qp = window.createQuickPick();
qp.items = sameItemsAsAbove;
qp.onDidAccept(() => {
qp.dispose();
window.showInformationMessage(`You selected: ${qp.selectedItems[0]?.label ?? 'nothing'}`);
});
qp.show();
gets you:

Things to test
- Play around with setting the
kind property
- Keep in mind that the only property that matters when setting
kind to Separator is label all others will be ignored (test this)
- Ensure you can set
label to empty string to add a blank separator
- in the long form, ensure you are also able to add buttons to the QPI and they are rendered properly (they'll be ignored if you add them to the separator QPIs) NOTE: You will need the latest
vscode.d.ts to test buttons as they are being finalized so run npx vscode-dts main
Useful stuff
"enabledApiProposals": [
"quickPickSeparators"
],
Note the name of the proposed API is gathered from the file name in the vscode-dts folder
Refs: #74967
Complexity: 4
Create Issue
In this milestone, we've introduced the highly anticipated QuickPick Separators into the API.
API definition:
vscode/src/vscode-dts/vscode.proposed.quickPickSeparators.d.ts
Lines 8 to 18 in d1640b7
When you set the
kindtoSeparatoron a QuickPickItem, that QPI will be treated like a separator. Here's an example:or the long form:
gets you:

Things to test
kindpropertykindtoSeparatorislabelall others will be ignored (test this)labelto empty string to add a blank separatorvscode.d.tsto test buttons as they are being finalized so runnpx vscode-dts mainUseful stuff
npx vscode-dts mainpackage.json(see below)npx vscode-dts devto get the typings