дзеркало
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]>
32 рядки
1.2 KiB
TypeScript
32 рядки
1.2 KiB
TypeScript
import { afterEach, describe, expect, it } from "vitest";
|
|
import { EditorState } from "@codemirror/state";
|
|
import { EditorView } from "@codemirror/view";
|
|
import {
|
|
HIGHLIGHTING_LEVEL_ITEMS,
|
|
highlightingLevelField,
|
|
highlightingLevelOf,
|
|
setHighlightingLevel,
|
|
} from "./localAppearance";
|
|
|
|
const views: EditorView[] = [];
|
|
afterEach(() => views.splice(0).forEach((view) => view.destroy()));
|
|
|
|
describe("highlightingLevelField", () => {
|
|
it("starts at All Problems and switches through the three levels", () => {
|
|
let state = EditorState.create({ doc: "const x = 1;", extensions: [highlightingLevelField] });
|
|
expect(highlightingLevelOf(state)).toBe("inspections");
|
|
for (const level of ["syntax", "none", "inspections"] as const) {
|
|
state = state.update({ effects: setHighlightingLevel.of(level) }).state;
|
|
expect(highlightingLevelOf(state)).toBe(level);
|
|
}
|
|
});
|
|
|
|
it("labels the three levels in IDEA's order and wording", () => {
|
|
expect(HIGHLIGHTING_LEVEL_ITEMS.map((item) => item.label)).toEqual(["None", "Syntax", "All Problems"]);
|
|
});
|
|
|
|
it("reports All Problems for a state without the field", () => {
|
|
expect(highlightingLevelOf(EditorState.create({ doc: "x" }))).toBe("inspections");
|
|
});
|
|
});
|