本文整理汇总了TypeScript中vscode.window.showQuickPick方法的典型用法代码示例。如果您正苦于以下问题:TypeScript window.showQuickPick方法的具体用法?TypeScript window.showQuickPick怎么用?TypeScript window.showQuickPick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vscode.window
的用法示例。
在下文中一共展示了window.showQuickPick方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setCommandMenu
export function setCommandMenu() {
const options = [
{
label: 'Run Red Script',
description: '',
command: 'red.interpret'
},
{
label: 'Run Red Script in GUI Console',
description: '',
command: 'red.interpretGUI'
},
{
label: 'Compile Red Script',
description: '',
command: 'red.compile'
},
{
label: 'Compile Red Script in GUI mode',
description: '',
command: 'red.compileGUI'
},
{
label: 'Compile Red/System Script',
description: '',
command: 'reds.compile'
},
{
label: 'Compile Red/System Script in GUI mode',
description: '',
command: 'reds.compileGUI'
}
];
vscode.window.showQuickPick(options).then(option => {
if (!option || !option.command || option.command.length === 0) {
return;
}
vscode.commands.executeCommand(option.command);
});
}
示例2: getUrl
function getUrl(ret) {
let options: vscode.QuickPickItem[] = [{
icon: 'code',
title: 'Production / Developer',
url: 'https://login.salesforce.com',
}, {
icon: 'beaker',
title: 'Sandbox / Test',
url: 'https://test.salesforce.com',
}].map(res => {
let icon: string = getIcon(res.icon);
return {
description: `${res.url}`,
// detail: `${'Detail'}`,
label: `$(${icon}) ${res.title}`,
};
});
return vscode.window.showQuickPick(options).then((res: vscode.QuickPickItem) => {
ret['url'] = res.description || 'https://login.salesforce.com';
return ret;
});
}
示例3: SfdxCommandBuilder
vscode.workspace.findFiles('config/*.json', '').then(files => {
const fileItems: vscode.QuickPickItem[] = files.map(file => {
return {
label: path.basename(file.toString()),
description: file.fsPath
};
});
vscode.window.showQuickPick(fileItems).then(selection => {
if (selection) {
const cancellationTokenSource = new vscode.CancellationTokenSource();
const cancellationToken = cancellationTokenSource.token;
const rootPath = vscode.workspace.rootPath!;
const selectionPath = path.relative(
rootPath,
selection.description.toString()
);
const execution = new CliCommandExecutor(
new SfdxCommandBuilder()
.withDescription(
nls.localize('force_org_create_default_scratch_org_text')
)
.withArg('force:org:create')
.withFlag('-f', `${selectionPath}`)
.withArg('--setdefaultusername')
.build(),
{ cwd: rootPath }
).execute(cancellationToken);
channelService.streamCommandOutput(execution);
notificationService.reportCommandExecutionStatus(
execution,
cancellationToken
);
CancellableStatusBar.show(execution, cancellationTokenSource);
taskViewService.addCommandExecution(execution, cancellationTokenSource);
}
});
});
示例4: execute
async execute(vimState: VimState): Promise<void> {
if (this.arguments.arg !== undefined && this.arguments.arg.length > 0) {
await this.displayRegisterValue(this.arguments.arg);
} else {
const currentRegisterKeys = Register.getKeys();
const registerKeyAndContent = new Array<any>();
for (let registerKey of currentRegisterKeys) {
registerKeyAndContent.push({
label: registerKey,
description: await this.getRegisterDisplayValue(registerKey),
});
}
vscode.window.showQuickPick(registerKeyAndContent).then(async val => {
if (val) {
let result = val.description;
vscode.window.showInformationMessage(`${val.label} ${result}`);
}
});
}
}
示例5: showQuickPick
export function showQuickPick()
{
// The code you place here will be executed every time your command is executed
let items: Array<SampleHelpers.QuickPickItem> = [
{
id: 0,
description: "description1",
detail: "detail1",
label: "label1"
},
{
id: 1,
description: "description2",
detail: "detail2",
label: "label2"
},
{
id: 2,
description: "description3",
detail: "detail3",
label: "label3"
}
]
let options: vscode.QuickPickOptions = {
onDidSelectItem: (item: SampleHelpers.QuickPickItem) =>
{
vscode.window.setStatusBarMessage(item.label);
},
matchOnDescription: false,
matchOnDetail: false,
placeHolder: "la"
}
vscode.window.showQuickPick<SampleHelpers.QuickPickItem>(items, options).then((item: SampleHelpers.QuickPickItem) =>
{
let id = item.id;
let label = item.label;
SampleHelpers.printInformation(showQuickPick, `${label} with id ${id} was selected.`, item);
})
}
示例6: openTextDocument
files => {
if (files.length == 1) {
const file = files.pop();
return openTextDocument(file.fsPath);
} else if (files.length > 1) {
let file_list = [];
files.forEach(file => {
file_list.push(file.fsPath);
});
return vscode.window.showQuickPick(file_list).then(
file => {
return openTextDocument(file);
},
reason => {
return Promise.reject(undefined);
}
);
}
// files.length == 0
return alwaysReject();
},
示例7: activateConnectionsList
public activateConnectionsList() {
const me = this;
let connections: PLSQLConnection[];
const active = this.controller.getActive();
if (active) {
connections = this.controller.getConnections().filter(item => item !== active);
connections.unshift(active);
} else
connections = this.controller.getConnections();
const displayItems = connections
.filter(item => item.active || !item.hidden)
.map(item => {
return {
label: `${item.active ? '$(check) ' : ''} ${item.name}`,
item: item,
action: 'setActive'
};
});
displayItems.push({
label: '<Insert a new connection>',
item: undefined,
action: 'addConnection'
});
displayItems.push({
label: '<Settings>',
item: undefined,
action: 'showSettings'
});
vscode.window.showQuickPick(displayItems)
.then(val => {
if (val) {
me[val.action].apply(me, [val.item]);
}
});
}
示例8: showWorkItems
private showWorkItems(wiql: string): void {
let self = this;
Logger.LogInfo("Getting work items...");
window.showQuickPick(self.getMyWorkItems(this._serverContext.RepoInfo.TeamProject, wiql), { matchOnDescription: true, placeHolder: Strings.ChooseWorkItem }).then(
function (workItem) {
if (workItem) {
let url: string = undefined;
if (workItem.id === undefined) {
self.ReportEvent(TelemetryEvents.OpenAdditionalQueryResults);
url = WorkItemTrackingService.GetWorkItemsBaseUrl(self._serverContext.RepoInfo.TeamProjectUrl);
} else {
self.ReportEvent(TelemetryEvents.ViewWorkItem);
url = WorkItemTrackingService.GetEditWorkItemUrl(self._serverContext.RepoInfo.TeamProjectUrl, workItem.id);
}
Logger.LogInfo("Work Item Url: " + url);
Utils.OpenUrl(url);
}
},
function (err) {
self.handleError(err, "Error selecting work item query from QuickPick");
}
);
}
示例9: toString
dotEnsimeUris.then((uris) => {
if(!uris) {
vscode.window.showErrorMessage("You are not in a workspace. Please open a project before using ENSIME.")
return
}
let dotEnsimes = toString(uris)
let filteredDotEnsime = dotEnsimes.filter(filterMethod)
if(filteredDotEnsime.length == 0)
{
vscode.window.showErrorMessage("No .ensime file found. Please generate with `sbt gen-ensime` or similar")
}
else if (filteredDotEnsime.length == 1)
{
callback(filteredDotEnsime[0])
}
else
{
vscode.window.showQuickPick(filteredDotEnsime).then((item) => callback(item))
}
})
示例10: fuzzyDefinitionSearch
return fuzzyDefinitionSearch(document, selection.active, new vscode.CancellationTokenSource().token).then(locations => {
if (!locations || locations.length === 0) {
let range = document.getWordRangeAtPosition(selection.active);
let message = range ? 'unable to find' : 'unable to find ' + document.getText(range);
vscode.window.setStatusBarMessage(message, 1500);
return;
}
if (locations.length === 1) {
return openLocation(locations[0]);
}
let picks = locations.map(l => ({
label: `${vscode.workspace.asRelativePath(l.uri)}:${l.range.start.line + 1}`,
description: l.uri.fsPath,
location: l
}));
return vscode.window.showQuickPick(picks).then(pick => {
return pick && openLocation(pick.location);
});
});