mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
#802 - Remove async update by retrieving folders from cache
This commit is contained in:
@@ -127,11 +127,6 @@ export class Article {
|
||||
|
||||
const update = ArticleHelper.generateUpdate(document, updatedArticle);
|
||||
|
||||
if (update) {
|
||||
const editor = window.activeTextEditor;
|
||||
await editor?.edit((builder) => builder.replace(update.range, update.newText));
|
||||
}
|
||||
|
||||
return [update];
|
||||
}
|
||||
|
||||
@@ -357,7 +352,7 @@ export class Article {
|
||||
const autoUpdate = Settings.get(SETTING_AUTO_UPDATE_DATE);
|
||||
|
||||
// Is article located in one of the content folders
|
||||
const folders = await Folders.get();
|
||||
const folders = Folders.getCached();
|
||||
const documentPath = parseWinPath(document.fileName);
|
||||
const folder = folders.find((f) => documentPath.startsWith(f.path));
|
||||
if (!folder) {
|
||||
|
||||
@@ -448,6 +448,14 @@ export class Folders {
|
||||
return Folders._folders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cached folder settings
|
||||
* @returns {ContentFolder[]} - The cached folder settings
|
||||
*/
|
||||
public static getCached(): ContentFolder[] {
|
||||
return Folders._folders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the folder settings
|
||||
* @param folders
|
||||
|
||||
Reference in New Issue
Block a user