Merge branch 'dev' of github.com:estruyf/vscode-front-matter into dev

This commit is contained in:
Elio Struyf
2023-08-30 15:51:13 +02:00
8 changed files with 14 additions and 3 deletions
+2
View File
@@ -5,6 +5,7 @@ src/**
.gitignore
vsc-extension-quickstart.md
**/tsconfig.json
**/tsconfig.e2e.json
**/*.map
**/*.ts
webpack.config.js
@@ -28,3 +29,4 @@ webpack
README.beta.md
e2e
storage
pnpm-lock.yaml
+1
View File
@@ -11,6 +11,7 @@
### ⚡️ Optimizations
- [#639](https://github.com/estruyf/vscode-front-matter/issues/639): Add check for content type in page folders setting
- [#642](https://github.com/estruyf/vscode-front-matter/issues/642): Store the search index in a storage file
### 🐞 Fixes
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

+8 -1
View File
@@ -331,8 +331,12 @@ export class Extension {
let storageUri: Uri | undefined = undefined;
if (type === 'global') {
storageUri = await this.createGlobalStorageIfNotExists();
// Clear workspace state
await this.ctx.globalState.update(propKey, undefined);
} else {
storageUri = await this.createLocalStorageIfNotExists();
// Clear workspace state
await this.ctx.workspaceState.update(propKey, undefined);
}
if (storageUri) {
@@ -429,7 +433,10 @@ export class Extension {
* @returns
*/
private isFileStorageNeeded(propKey: string) {
return propKey === ExtensionState.Dashboard.Pages.Cache;
return (
propKey === ExtensionState.Dashboard.Pages.Cache ||
propKey === ExtensionState.Dashboard.Pages.Index
);
}
/**
+3 -2
View File
@@ -243,7 +243,7 @@ export class PagesListener extends BaseListener {
const pagesIndex = Fuse.createIndex(['title', 'slug', 'description', 'fmBody', 'type'], pages);
await Extension.getInstance().setState(
ExtensionState.Dashboard.Pages.Index,
pagesIndex,
pagesIndex.toJSON(),
'workspace'
);
}
@@ -279,7 +279,8 @@ export class PagesListener extends BaseListener {
ExtensionState.Dashboard.Pages.Index,
'workspace'
);
const fuse = new Fuse(this.lastPages, fuseOptions, pagesIndex);
const fuseIndex = Fuse.parseIndex(pagesIndex);
const fuse = new Fuse(this.lastPages, fuseOptions, fuseIndex);
const results = fuse.search(data.query || '');
const pageResults = results.map((page) => page.item);