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

+5 -35
Переглянути файл
@@ -672,6 +672,11 @@
font-size: var(--fs-small);
color: var(--fg-secondary);
}
/* SQL types (INT, VARCHAR) read as keywords, as in the SQL editor. */
.sqlPreview :global(.tok-typeName),
.codeText :global(.tok-typeName) {
color: var(--syn-keyword);
}
.sqlPreview {
margin: 0;
padding: 8px 10px;
@@ -690,41 +695,6 @@
-webkit-user-select: text;
user-select: text;
}
.sqlPreview :global(.tok-keyword),
.codeText :global(.tok-keyword),
.sqlPreview :global(.tok-operatorKeyword),
.codeText :global(.tok-operatorKeyword) {
color: var(--syn-keyword);
}
.sqlPreview :global(.tok-string),
.codeText :global(.tok-string),
.sqlPreview :global(.tok-string2),
.codeText :global(.tok-string2) {
color: var(--syn-string);
}
.sqlPreview :global(.tok-number),
.codeText :global(.tok-number),
.sqlPreview :global(.tok-bool),
.codeText :global(.tok-bool),
.sqlPreview :global(.tok-atom),
.codeText :global(.tok-atom) {
color: var(--syn-number);
}
.sqlPreview :global(.tok-typeName),
.codeText :global(.tok-typeName) {
color: var(--syn-keyword);
}
.sqlPreview :global(.tok-comment),
.codeText :global(.tok-comment) {
color: var(--syn-comment);
font-style: italic;
}
.sqlPreview :global(.tok-punctuation),
.codeText :global(.tok-punctuation),
.sqlPreview :global(.tok-operator),
.codeText :global(.tok-operator) {
color: var(--syn-punct);
}
.modifyBody {
display: flex;
flex-direction: column;