дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 03:05:40 +02:00
fix(editor): Match PyCharm syntax colours and text weight
Greyscale antialiasing mapped to `-webkit-font-smoothing: antialiased`, which drops macOS stem darkening, so editor and UI text rendered thinner and syntax colours looked lighter than PyCharm's. Use `auto` instead. Align lezer tag mappings with PyCharm's Light scheme: - HTML/XML: `<!doctype>` is plain text (documentMeta is a sub-tag of meta). - CSS/SCSS/Sass: property names use the attribute colour; values and units the attribute-value colour; class, id, pseudo, colour and url() the tag colour. - YAML: keys are keywords. - Markdown: quotes are strings with keyword markers, link destinations italic function colour, titles strings, horizontal rules keywords. Claude-Session: https://claude.ai/code/session_01SaPPsVPuk6ZTNsoUCNCbMv
Цей коміт міститься в:
1 джерело
4a2d5c9599
коміт
c8cea62eab
3 files changed
+30
-6
No files matched your search
@@ -18,6 +18,9 @@ function token(tag: Tag | Tag[], name: string, defaults: { italic?: string; bold
|
||||
}
|
||||
|
||||
export const openideaHighlightStyle = HighlightStyle.define([
|
||||
// Markdown tags whole links / quotes; listed first so marks, URL and title inside keep their own colours.
|
||||
token(t.link, "link", { effect: "underline" }),
|
||||
token(t.quote, "string"),
|
||||
token([t.keyword, t.controlKeyword, t.moduleKeyword, t.operatorKeyword, t.definitionKeyword, t.modifier, t.null, t.bool, t.unit], "keyword"),
|
||||
token(t.self, "self"),
|
||||
token([t.string, t.special(t.string), t.character, t.attributeValue], "string"),
|
||||
@@ -31,7 +34,9 @@ export const openideaHighlightStyle = HighlightStyle.define([
|
||||
token([t.function(t.definition(t.variableName)), t.definition(t.function(t.variableName)), t.function(t.definition(t.propertyName))], "function"),
|
||||
token([t.comment, t.lineComment, t.blockComment], "comment", { italic: "var(--syn-comment-style)" }),
|
||||
token(t.docComment, "doc-comment", { italic: "italic" }),
|
||||
token([t.meta, t.annotation, t.macroName, t.documentMeta], "decorator"),
|
||||
token([t.meta, t.annotation, t.macroName], "decorator"),
|
||||
// `<!doctype>` is a sub-tag of `meta`; PyCharm leaves the XML prologue as plain text.
|
||||
{ tag: t.documentMeta, color: "var(--fg-editor)" },
|
||||
token([t.constant(t.variableName), t.atom, t.special(t.variableName)], "constant", { italic: "italic" }),
|
||||
token(t.labelName, "constant"),
|
||||
token([t.variableName, t.definition(t.variableName), t.local(t.variableName)], "variable"),
|
||||
@@ -46,9 +51,10 @@ export const openideaHighlightStyle = HighlightStyle.define([
|
||||
{ tag: t.emphasis, fontStyle: "italic" },
|
||||
{ tag: t.strong, fontWeight: "600" },
|
||||
{ tag: t.strikethrough, textDecoration: "line-through" },
|
||||
token([t.link, t.url], "link", { effect: "underline" }),
|
||||
// Markdown, as IntelliJ: link destination like a static method, rules like markers.
|
||||
token(t.url, "function", { italic: "italic" }),
|
||||
token(t.monospace, "markup-code"),
|
||||
token(t.quote, "comment"),
|
||||
token(t.contentSeparator, "keyword"),
|
||||
{ tag: t.inserted, color: "var(--vcs-added)" },
|
||||
{ tag: t.deleted, color: "var(--danger)" },
|
||||
{ tag: t.changed, color: "var(--vcs-modified)" },
|
||||
|
||||
@@ -63,9 +63,25 @@ export function loadSupport(desc: LanguageDescription): Promise<LanguageSupport
|
||||
return p;
|
||||
}
|
||||
|
||||
/** Highlighting the stock grammars lack (IntelliJ colours annotations; @lezer/java tags them as plain identifiers). */
|
||||
/**
|
||||
* PyCharm CSS colours: selectors fall back to HTML tag name, property names to
|
||||
* HTML attribute name, values and units to HTML attribute value.
|
||||
*/
|
||||
const CSS_TAGS: Parameters<typeof styleTags>[0] = {
|
||||
"FeatureName PropertyName": t.attributeName,
|
||||
"ValueName FontName Unit": t.attributeValue,
|
||||
"ClassName IdName PseudoClassName ColorLiteral CallTag": t.tagName,
|
||||
};
|
||||
|
||||
/** Highlighting the stock grammars lack or colour unlike IntelliJ. */
|
||||
const EXTRA_TAGS: Record<string, Parameters<typeof styleTags>[0]> = {
|
||||
// @lezer/java tags annotations as plain identifiers.
|
||||
Java: { "MarkerAnnotation/Identifier Annotation/Identifier MarkerAnnotation Annotation": t.annotation },
|
||||
CSS: CSS_TAGS,
|
||||
SCSS: CSS_TAGS,
|
||||
Sass: CSS_TAGS,
|
||||
// YAML keys are keywords in IntelliJ.
|
||||
YAML: { "Key/Literal Key/QuotedLiteral": t.keyword },
|
||||
};
|
||||
|
||||
function patchSupport(desc: LanguageDescription, support: LanguageSupport): LanguageSupport {
|
||||
|
||||
@@ -26,7 +26,8 @@ body {
|
||||
font-family: var(--font-ui);
|
||||
font-size: var(--fs-ui);
|
||||
line-height: 1.4;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
/* Greyscale: `auto` keeps macOS stem darkening, as JetBrains IDEs render text. */
|
||||
-webkit-font-smoothing: auto;
|
||||
overflow: hidden;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
@@ -134,8 +135,9 @@ a:hover {
|
||||
:root[data-aa-ide="none"] body {
|
||||
-webkit-font-smoothing: none;
|
||||
}
|
||||
/* `antialiased` drops stem darkening: glyphs and syntax colours render lighter than PyCharm's. */
|
||||
:root[data-aa-editor="greyscale"] .cm-editor {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-font-smoothing: auto;
|
||||
}
|
||||
:root[data-aa-editor="subpixel"] .cm-editor {
|
||||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
|
||||
Reference in new issue
Заблокувати користувача