MCPcopy
hub / github.com/callumalpass/tasknotes / getSearchText

Method getSearchText

src/modals/FileSelectorModal.ts:299–321  ·  view source on GitHub ↗
(file: TAbstractFile)

Source from the content-addressed store, hash-verified

297 }
298
299 private getSearchText(file: TAbstractFile): string {
300 let text = `${file.name} ${file.path}`;
301
302 if (file instanceof TFile) {
303 const cache = this.app.metadataCache.getFileCache(file);
304 if (cache?.frontmatter) {
305 // Add title
306 const titleField = this.plugin.fieldMapper.toUserField("title");
307 const title = cache.frontmatter[titleField];
308 if (title) {
309 text += ` ${title}`;
310 }
311
312 // Add aliases
313 const aliases = parseFrontMatterAliases(cache.frontmatter);
314 if (aliases && aliases.length > 0) {
315 text += ` ${aliases.join(" ")}`;
316 }
317 }
318 }
319
320 return text;
321 }
322
323 renderSuggestion(file: TAbstractFile, el: HTMLElement): void {
324 const container = el.createDiv({ cls: "file-selector-suggestion" });

Callers 1

getSuggestionsMethod · 0.95

Calls 3

parseFrontMatterAliasesFunction · 0.90
getFileCacheMethod · 0.80
toUserFieldMethod · 0.65

Tested by

no test coverage detected