(doc: Text, index: number)
| 79 | } |
| 80 | |
| 81 | function readWordBefore(doc: Text, index: number): string { |
| 82 | let pos = index; |
| 83 | while (pos >= 0 && isWhitespace(charAt(doc, pos))) pos--; |
| 84 | if (pos < 0) return ""; |
| 85 | if (charAt(doc, pos) === "(") { |
| 86 | pos--; |
| 87 | } |
| 88 | while (pos >= 0 && isWhitespace(charAt(doc, pos))) pos--; |
| 89 | const end = pos; |
| 90 | while (pos >= 0 && isAlpha(charAt(doc, pos))) pos--; |
| 91 | const start = pos + 1; |
| 92 | if (end < start) return ""; |
| 93 | return doc.sliceString(start, end + 1).toLowerCase(); |
| 94 | } |
| 95 | |
| 96 | function shouldRenderColor(doc: Text, start: number, end: number): boolean { |
| 97 | const immediatePrev = charAt(doc, start - 1); |
no test coverage detected