From 95ae50c24e72a5dd990afc3d53a6b7b8db4ab559 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Fri, 27 Aug 2021 12:31:50 +0200 Subject: [PATCH] Small optimization for content folder selection --- src/commands/Folders.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/commands/Folders.ts b/src/commands/Folders.ts index d699c9a8..09ecca4c 100644 --- a/src/commands/Folders.ts +++ b/src/commands/Folders.ts @@ -1,5 +1,5 @@ import { commands, Uri, workspace, window } from "vscode"; -import { CONFIG_KEY, SETTINGS_CONTENT_FOLDERS } from "../constants"; +import { SETTINGS_CONTENT_FOLDERS } from "../constants"; import { basename, join } from "path"; import { ContentFolder, FileInfo, FolderInfo } from "../models"; import uniqBy = require("lodash.uniqby"); @@ -22,9 +22,14 @@ export class Folders { return; } - const selectedFolder = await window.showQuickPick(folders.map(f => f.title), { - placeHolder: `Select where you want to create your content` - }); + let selectedFolder: string | undefined; + if (folders.length > 1) { + selectedFolder = await window.showQuickPick(folders.map(f => f.title), { + placeHolder: `Select where you want to create your content` + }); + } else { + selectedFolder = folders[0].title; + } if (!selectedFolder) { Notifications.warning(`You didn't select a place where you wanted to create your content.`);