Summarize loaded source text for expansion highlighting invalidation.
(text: string)
| 10 | |
| 11 | /** Summarize loaded source text for expansion highlighting invalidation. */ |
| 12 | function sourceTextFingerprint(text: string) { |
| 13 | let hash = 2166136261; |
| 14 | |
| 15 | for (let index = 0; index < text.length; index += 1) { |
| 16 | hash ^= text.charCodeAt(index); |
| 17 | hash = Math.imul(hash, 16777619); |
| 18 | } |
| 19 | |
| 20 | return `${text.length}:${(hash >>> 0).toString(36)}`; |
| 21 | } |
| 22 | |
| 23 | /** Cache key for full-source highlights used by expanded unchanged rows. */ |
| 24 | function buildSourceCacheKey(theme: AppTheme, file: DiffFile, text: string) { |
no outgoing calls
no test coverage detected