Skip to content

Commit 65e88a1

Browse files
committed
Include the title of the file in the simple search
1 parent 615b3bc commit 65e88a1

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

mocks/obsidian.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class DataAdapter {
2222
_read = "";
2323
_readBinary = new ArrayBuffer(0);
2424
_write: [string, string];
25-
_writeBinary : [string, ArrayBuffer];
25+
_writeBinary: [string, ArrayBuffer];
2626
_remove: [string];
2727
_stat = new Stat();
2828

@@ -42,12 +42,12 @@ class DataAdapter {
4242
return this._readBinary;
4343
}
4444

45-
async write(path: string, content: string, option?:DataWriteOptions): Promise<void> {
45+
async write(path: string, content: string, option?: DataWriteOptions): Promise<void> {
4646
this._write = [path, content];
4747
}
4848

49-
async writeBinary(path: string, content: ArrayBuffer, option?:DataWriteOptions): Promise<void> {
50-
this._writeBinary = [path,content]
49+
async writeBinary(path: string, content: ArrayBuffer, option?: DataWriteOptions): Promise<void> {
50+
this._writeBinary = [path, content]
5151
}
5252

5353
async remove(path: string): Promise<void> {
@@ -72,7 +72,7 @@ export class Vault {
7272
return this._cachedRead;
7373
}
7474

75-
async createFolder(path: string): Promise<void> {}
75+
async createFolder(path: string): Promise<void> { }
7676

7777
getFiles(): TFile[] {
7878
return this._files;
@@ -158,14 +158,15 @@ export class FileStats {
158158

159159
export class TFile {
160160
path = "somefile.md";
161+
basename: string = "somefile";
161162
stat: FileStats = new FileStats();
162163
}
163164

164165
export class PluginManifest {
165166
version = "";
166167
}
167168

168-
export class SettingTab {}
169+
export class SettingTab { }
169170

170171
export const apiVersion = "1.0.0";
171172

src/requestHandler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ export default class RequestHandler {
262262
certificateInfo:
263263
this.requestIsAuthenticated(req) && certificate
264264
? {
265-
validityDays: getCertificateValidityDays(certificate),
266-
regenerateRecommended:
267-
!getCertificateIsUptoStandards(certificate),
268-
}
265+
validityDays: getCertificateValidityDays(certificate),
266+
regenerateRecommended:
267+
!getCertificateIsUptoStandards(certificate),
268+
}
269269
: undefined,
270270
apiExtensions: this.requestIsAuthenticated(req)
271271
? this.apiExtensions.map(({ manifest }) => manifest)
@@ -1012,7 +1012,7 @@ export default class RequestHandler {
10121012

10131013
for (const file of this.app.vault.getMarkdownFiles()) {
10141014
const cachedContents = await this.app.vault.cachedRead(file);
1015-
const result = search(cachedContents);
1015+
const result = search(file.basename + "\n\n" + cachedContents);
10161016
if (result) {
10171017
const contextMatches: SearchContext[] = [];
10181018
for (const match of result.matches) {

0 commit comments

Comments
 (0)