дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 17:47:08 +02:00
fix(editor): map t.namespace to Package reference, not Class name (#6684)
Syntax highlighting coloured t.namespace with Class name while semantic highlighting used Package reference, so namespace identifiers changed colour once the language server's tokens arrived. t.namespace now uses the namespace scheme attribute and falls back to Class name when a scheme leaves it unset. Co-authored-by: zhzhsx <[email protected]>
Цей коміт міститься в:
1 джерело
fa625d8cc7
коміт
8aeac949b5
2 files changed
+10
-1
No files matched your search
@@ -53,7 +53,9 @@ export const openideaHighlightStyle = HighlightStyle.define([
|
||||
token(t.escape, "escape"),
|
||||
token(t.regexp, "regexp"),
|
||||
token([t.number, t.integer, t.float], "number"),
|
||||
token([t.typeName, t.className, t.namespace, t.definition(t.typeName)], "type"),
|
||||
token([t.typeName, t.className, t.definition(t.typeName)], "type"),
|
||||
// Package references get their own scheme attribute (IDEA's Package reference), with Class name as fallback.
|
||||
token(t.namespace, "namespace", { color: "type" }),
|
||||
token(t.standard(t.variableName), "builtin"),
|
||||
token(t.standard(t.typeName), "builtin-type", { color: "builtin" }),
|
||||
token(t.standard(t.function(t.variableName)), "builtin-function", { color: "builtin" }),
|
||||
|
||||
@@ -54,6 +54,13 @@ describe("syntaxHighlightField", () => {
|
||||
expect(marks(state)).toEqual([{ text: "def", cls: command }]);
|
||||
});
|
||||
|
||||
it("maps t.namespace to Package reference, not Class name", () => {
|
||||
const namespaceClass = openideaHighlightStyle.style([t.namespace]);
|
||||
const typeClass = openideaHighlightStyle.style([t.typeName]);
|
||||
expect(namespaceClass).toBeTruthy();
|
||||
expect(namespaceClass).not.toBe(typeClass);
|
||||
});
|
||||
|
||||
it("lets Kotlin declaration roles override the stream lexer's generic definition style", async () => {
|
||||
const support = await loadSupport(findLanguageDescription("Kotlin", "demo.kt")!);
|
||||
const view = new EditorView({
|
||||
|
||||
Reference in new issue
Заблокувати користувача