MCPcopy Create free account
hub / github.com/CatMuse/HiNote / findHighlights

Method findHighlights

src/services/HighlightManager.ts:120–134  ·  view source on GitHub ↗

* 根据文本和位置查找高亮 * @param file 文件 * @param highlight 高亮信息(包含 text 和 position) * @returns 匹配的高亮数组

(file: TFile, highlight: { text: string; position?: number })

Source from the content-addressed store, hash-verified

118 * @returns 匹配的高亮数组
119 */
120 async findHighlights(file: TFile, highlight: { text: string; position?: number }): Promise<HiNote[]> {
121 if (!file) return [];
122
123 const fileHighlights = await this.repository.getFileHighlights(file.path);
124
125 return fileHighlights.filter(c => {
126 const textMatch = c.text === highlight.text;
127 if (!textMatch) return false;
128
129 if (typeof c.position === 'number' && typeof highlight.position === 'number') {
130 return Math.abs(c.position - highlight.position) < 1000;
131 }
132 return true;
133 });
134 }
135
136 /**
137 * 根据 blockId 查找高亮

Callers

nothing calls this directly

Calls 1

getFileHighlightsMethod · 0.65

Tested by

no test coverage detected