このラッパーを使ってファイルピッカー?を作る
function showFilePicker(root: string, defaultValue: string, query: string) {
const selectHandler = (quickPick: vscode.QuickPick<vscode.QuickPickItem>) => {
const selected = quickPick.selectedItems[0].label;
const path = vscode.Uri.parse(root + encodeURI(selected));
vscode.workspace.openTextDocument(path)
.then(doc => vscode.window.showTextDocument(doc));
quickPick.hide();
};
vscode.workspace.findFiles(query)
.then(urls => { return urls.map(url => decodeURI(url.toString().replace(root, ''))); })
.then(map => {
const items = map.map(url => { return { label: url }; });
const quickPick = createQuickPick(items, selectHandler, defaultValue);
quickPick.show();
});
}
通報 ...