feat: Syntax-colour Find in Files and Show Usages result lines (#143)

Result lines in the Find in Files popup and tool window and in the Show Usages popup and Usages tool window are coloured like the editor, using the whole file as context, so a line inside a block comment or a multi-line string gets the right colour. The colouring lives in editor/lineTokens and all four lists share it; each file is parsed once and cached, and the parse runs in 8 ms time slices so large files don't block the UI thread. Lines that moved since the search, and files over 500k characters, are coloured on their own.

Claude-Session: https://claude.ai/code/session_01Dq6jQQn8ZhRfkkyj3PRutA
Co-authored-by: jaw52 <[email protected]>
This commit is contained in:
Jaw authored and GitHub committed 2026-10-29 00:18:02 +08:00
1 parent 1d383e608c
commit 811da13a76
15 files changed
+466 -44

No files matched your search

@@ -92,6 +92,40 @@
color: var(--fg-search-match, inherit);
border-radius: 2px;
}
/* Lezer classHighlighter tokens of usage lines (same colours as Find in Files results). */
.preview :global(.tok-keyword),
.preview :global(.tok-modifier),
.preview :global(.tok-controlKeyword),
.preview :global(.tok-operatorKeyword) {
color: var(--syn-keyword);
}
.preview :global(.tok-string),
.preview :global(.tok-string2) {
color: var(--syn-string);
}
.preview :global(.tok-number),
.preview :global(.tok-bool),
.preview :global(.tok-atom) {
color: var(--syn-number);
}
.preview :global(.tok-typeName),
.preview :global(.tok-className),
.preview :global(.tok-namespace) {
color: var(--syn-type);
}
.preview :global(.tok-comment) {
color: var(--syn-comment);
}
.preview :global(.tok-meta),
.preview :global(.tok-macroName) {
color: var(--syn-annotation);
}
.preview :global(.tok-propertyName) {
color: var(--syn-property);
}
.preview :global(.tok-variableName.tok-definition) {
color: var(--syn-function);
}
.note {
min-width: 0;