(file: TAbstractFile)
| 90 | } |
| 91 | |
| 92 | getItemText(file: TAbstractFile): string { |
| 93 | if (!(file instanceof TFile)) { |
| 94 | return file.name; |
| 95 | } |
| 96 | |
| 97 | let text = `${file.name} ${file.path}`; |
| 98 | |
| 99 | // Use the same searchable fields as the inline autosuggest |
| 100 | const rows = this.plugin.settings?.projectAutosuggest?.rows ?? []; |
| 101 | const searchableFields = new Set<string>(); |
| 102 | |
| 103 | // Parse searchable fields from configuration |
| 104 | for (const row of rows) { |
| 105 | try { |
| 106 | const tokens = parseDisplayFieldsRow(row); |
| 107 | for (const token of tokens) { |
| 108 | if (token.searchable && !token.property.startsWith("literal:")) { |
| 109 | searchableFields.add(token.property); |
| 110 | } |
| 111 | } |
| 112 | } catch { |
| 113 | // Ignore parse errors |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | const cache = this.app.metadataCache.getFileCache(file); |
| 118 | if (cache?.frontmatter) { |
| 119 | const mapped = this.plugin.fieldMapper.mapFromFrontmatter( |
| 120 | cache.frontmatter, |
| 121 | file.path, |
| 122 | this.plugin.settings.storeTitleInFilename |
| 123 | ); |
| 124 | |
| 125 | // Always include title and aliases (default searchable) |
| 126 | const title = typeof mapped.title === "string" ? mapped.title : ""; |
| 127 | if (title) { |
| 128 | text += ` ${title}`; |
| 129 | } |
| 130 | |
| 131 | const aliases = parseFrontMatterAliases(cache.frontmatter) || []; |
| 132 | if (Array.isArray(aliases) && aliases.length > 0) { |
| 133 | text += ` ${aliases.join(" ")}`; |
| 134 | } |
| 135 | |
| 136 | // Add additional searchable fields based on configuration |
| 137 | for (const fieldKey of searchableFields) { |
| 138 | let value = ""; |
| 139 | |
| 140 | switch (fieldKey) { |
| 141 | case "file.path": |
| 142 | value = file.path; |
| 143 | break; |
| 144 | case "file.parent": |
| 145 | value = file.parent?.name || ""; |
| 146 | break; |
| 147 | case "file.basename": |
| 148 | value = file.basename; // Already included as file.name |
| 149 | break; |
nothing calls this directly
no test coverage detected