feat(ui): syntax-highlight the read-only source previews (#1284)

The read-only previews beside Problems, Show Usages and TODO results are syntax-coloured from one whole-file parse (capped for very large files), so a line inside a block comment or a multi-line string is coloured as such; the pane renders plain first and recolours when the parse lands. SourcePreview takes the colouring as a colorize prop (the editor's previewColors), keeping src/ui free of editor imports, and the tok-* colours live once in global.css instead of a copy per view, with the theme's comment style.

Co-authored-by: qtvbwfn <[email protected]>
Цей коміт міститься в:
Qingтаqtvbwfn authored and GitHub committed 2026-11-05 00:55:03 +08:00
1 джерело f4fa2b42f6
коміт 78a3768ec1
15 files changed
+297 -293

No files matched your search

-34
Переглянути файл
@@ -95,40 +95,6 @@
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;