import { EditorView } from "@codemirror/view"; import { commands } from "../src/platform/ipc"; import { setInvokeRoute } from "../src/platform/tauriCore"; import { schemeCss } from "../src/platform/colorScheme"; import { lspDoc } from "../src/editor/lsp/lsp"; import { semanticExtension } from "../src/editor/lsp/semantic"; import { lspTheme } from "../src/editor/lsp/theme"; // jdtls's tokens for four fields, one per line: instance, instance final, static, static final. setInvokeRoute(() => null); commands.lspSemanticTokens = async () => ({ status: "ok", data: { tokenTypes: ["property"], tokenModifiers: ["static", "readonly"], data: [0, 0, 5, 0, 0, 1, 0, 4, 0, 2, 2, 0, 6, 0, 1, 3, 0, 3, 0, 3], }, }); const style = document.createElement("style"); style.textContent = schemeCss("dark", { dark: { staticField: { foreground: "#9876aa" }, "java.staticFinalField": { bold: true }, "java.instanceFinalField": { foreground: "#cc7832" }, }, }); document.head.append(style); new EditorView({ parent: document.body, doc: "count\ncode\nactive\nMAX", extensions: [ EditorView.editorAttributes.of({ "data-language": "Java" }), lspTheme, lspDoc.of({ doc: 1, path: "A.java", language: "java", uiMode: "Java", readOnly: false }), semanticExtension(), ], });