* 生成高亮ID * 基于文件路径、位置和文本内容生成稳定的ID * @param filePath 文件路径 * @param position 位置 * @param text 高亮文本 * @returns 稳定的高亮ID
(filePath: string, position: number, text: string)
| 12 | * @returns 稳定的高亮ID |
| 13 | */ |
| 14 | static generateHighlightId(filePath: string, position: number, text: string): string { |
| 15 | // 使用文件路径、位置和文本内容生成稳定的哈希 |
| 16 | const content = `${filePath}:${position}:${text}`; |
| 17 | const hash = this.hashCode(content); |
| 18 | return `highlight-${Math.abs(hash)}-${position}`; |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * 生成批注ID |
no test coverage detected