#145 - Moved folder registration settings

This commit is contained in:
Elio Struyf
2021-10-12 15:22:43 +02:00
parent f51fec5fb9
commit 986fd95524
4 changed files with 17 additions and 2 deletions
+1
View File
@@ -5,6 +5,7 @@
### 🎨 Enhancements
- [#141](https://github.com/estruyf/vscode-front-matter/issues/141): Allow content creation for page bundles or single files
- [#145](https://github.com/estruyf/vscode-front-matter/issues/145): Moved folder registration settings to `frontmatter.json` file
### 🐞 Fixes
+5 -1
View File
@@ -274,7 +274,11 @@ export class Folders {
*/
private static async update(folders: ContentFolder[]) {
const wsFolder = Folders.getWorkspaceFolder();
await Settings.update(SETTINGS_CONTENT_PAGE_FOLDERS, folders.map(folder => ({ title: folder.title, path: Folders.relWsFolder(folder, wsFolder) })));
let folderDetails = folders.map(folder => ({
title: folder.title,
path: Folders.relWsFolder(folder, wsFolder)
}));
await Settings.update(SETTINGS_CONTENT_PAGE_FOLDERS, folderDetails, true);
}
/**
+10
View File
@@ -5,6 +5,16 @@ import { Notifications } from './Notifications';
export class Questions {
/**
* Yes/No question
* @param placeholder
* @returns
*/
public static async yesOrNo(placeholder: string) {
const answer = await window.showQuickPick(["yes", "no"], { canPickMany: false, placeHolder: placeholder, ignoreFocusOut: false });
return answer === "yes";
}
/**
* Specify the name of the content to create
* @param showWarning
+1 -1
View File
@@ -136,7 +136,7 @@ export class Settings {
Settings.globalConfig = JSON.parse(localConfig);
Settings.globalConfig[`${CONFIG_KEY}.${name}`] = value;
writeFileSync(fmConfig, JSON.stringify(Settings.globalConfig, null, 2), 'utf8');
const workspaceSettingValue = Settings.hasWorkspaceSettings<ContentType[]>(name);
if (workspaceSettingValue) {
await Settings.update(name, undefined);