дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
Kotlin files showed declarations, parameters, fields, annotations, KDoc and escapes in generic lexer colours, because the CodeMirror mode alone drove their highlighting. Kotlin now gets supplemental backend marks from its tree-sitter grammar, which take precedence over lexer marks while LSP semantic marks stay innermost. The semantic provider also maps the mutable and operator-declaration tokens. Siblings covered: other grammars keep their parameter colours, and constructor default values are highlighted as values. Co-authored-by: shohruh-genius <[email protected]>
34 рядки
1.5 KiB
TypeScript
34 рядки
1.5 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
test("Kotlin backend roles override lexer styles", async ({ page }) => {
|
|
await page.goto("/e2e/kotlinHighlight.html");
|
|
const greet = page
|
|
.locator(".cm-line span")
|
|
.filter({ hasText: /^greet$/ })
|
|
.last();
|
|
await expect(greet).toHaveCSS("color", "rgb(85, 119, 153)");
|
|
await expect(greet).toHaveCSS("background-color", "rgb(221, 238, 255)");
|
|
await expect(greet).toHaveCSS("font-weight", "700");
|
|
await expect(
|
|
page
|
|
.locator(".cm-line span")
|
|
.filter({ hasText: /^prefix$/ })
|
|
.last(),
|
|
).toHaveCSS("color", "rgb(102, 136, 170)");
|
|
});
|
|
|
|
test("Kotlin semantic roles stay inside backend and lexer marks", async ({ page }) => {
|
|
await page.goto("/e2e/kotlinHighlight.html?semantic");
|
|
const declaration = page.locator(".cm-sem-function.cm-sem-declaration");
|
|
await expect(declaration).toHaveText("greet");
|
|
await expect(declaration).toHaveCSS("color", "rgb(85, 119, 153)");
|
|
await expect(declaration).toHaveCSS("background-color", "rgb(221, 238, 255)");
|
|
await expect(declaration).toHaveCSS("font-weight", "700");
|
|
await expect(declaration.locator("span")).toHaveCount(0);
|
|
const parameter = page.locator(".cm-sem-parameter.cm-sem-mutable");
|
|
await expect(parameter).toHaveText("prefix");
|
|
await expect(parameter).toHaveCSS("color", "rgb(102, 136, 170)");
|
|
await expect(parameter).toHaveCSS("text-decoration-line", "underline");
|
|
await expect(parameter.locator("span")).toHaveCount(0);
|
|
});
|