дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 01:01:17 +02:00
Add Configure Current File Analysis… (editor.highlightingLevel, IDEA's PopupHector, Cmd+Alt+Shift+H / Ctrl+Alt+Shift+H) with the three levels None, Syntax and All Problems: - All Problems (default): everything as before. - Syntax: syntax and semantic colouring stay; diagnostics and their scrollbar marks leave the editor (Problems still lists them). - None: plain text; the lezer highlighter is reconfigured out and semantic tokens are dropped. The level lives in the editor state next to the other per-editor display overrides (cm/localAppearance.ts) and is not saved. Co-authored-by: muutot <[email protected]>
69 рядки
2.5 KiB
TypeScript
69 рядки
2.5 KiB
TypeScript
import { expect, openFromTree, stubDesktop, test } from "./fixtures";
|
|
|
|
const FILE = "/dev/acme-api/build.gradle.kts";
|
|
|
|
test("highlighting level: Configure Current File Analysis switches what the editor highlights", async ({
|
|
workbench: page,
|
|
}) => {
|
|
const editor = await openFromTree(page, "build.gradle.kts");
|
|
await stubDesktop(page);
|
|
await editor.locator(".cm-line", { hasText: "val order: Order" }).click();
|
|
await editor.locator(".cm-content").focus();
|
|
await page.evaluate((file) => {
|
|
window.__ipc.emit({
|
|
type: "diagnostics",
|
|
path: file,
|
|
source: "kotlin",
|
|
items: [
|
|
{
|
|
range: { start: { line: 20, col: 19 }, end: { line: 20, col: 24 } },
|
|
severity: "error",
|
|
message: "Unresolved reference: Order",
|
|
source: "kotlin",
|
|
code: null,
|
|
},
|
|
],
|
|
});
|
|
}, FILE);
|
|
const squiggle = editor.locator(".cm-lintRange-error");
|
|
await expect(squiggle).toHaveText("Order", { timeout: 15000 });
|
|
|
|
const menu = page.getByRole("menu", { name: /^Highlighting Level$/ });
|
|
const choose = async (level: string) => {
|
|
await page.evaluate(async () => {
|
|
const path = "/src/platform/actions.ts";
|
|
const { executeAction } = await import(/* @vite-ignore */ path);
|
|
await executeAction("editor.highlightingLevel");
|
|
});
|
|
await menu.getByRole("menuitemcheckbox", { name: level, exact: true }).click();
|
|
};
|
|
|
|
// The chooser starts at IDEA's All Problems.
|
|
await page.evaluate(async () => {
|
|
const path = "/src/platform/actions.ts";
|
|
const { executeAction } = await import(/* @vite-ignore */ path);
|
|
await executeAction("editor.highlightingLevel");
|
|
});
|
|
await expect(menu.getByRole("menuitemcheckbox", { name: "All Problems", exact: true })).toHaveAttribute(
|
|
"aria-checked",
|
|
"true",
|
|
);
|
|
await page.keyboard.press("Escape");
|
|
|
|
// Syntax keeps the colouring and takes the diagnostics out of the editor.
|
|
await choose("Syntax");
|
|
await expect(squiggle).toHaveCount(0);
|
|
|
|
// None also reconfigures the lezer highlighter out: a line without the caret keeps no spans.
|
|
await choose("None");
|
|
await editor.locator(".cm-content").focus();
|
|
await page.keyboard.press("ArrowUp");
|
|
const plainLine = editor.locator(".cm-content .cm-line").filter({ hasText: "// Paged order lookup" }).first();
|
|
await expect(plainLine).toBeVisible();
|
|
await expect(plainLine.locator("span")).toHaveCount(0);
|
|
|
|
// Back to All Problems: the squiggle returns without a new diagnostics event.
|
|
await choose("All Problems");
|
|
await expect(squiggle).toHaveText("Order");
|
|
});
|