дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 09:11:10 +02:00
feat(editor): style Java static, constant and final fields separately (#7930)
Java fields get their own colour scheme attributes under Java > Class Fields: instance field, instance final field, static field and constant (static final field), each falling back through the field kind it refines to Language Defaults > Identifiers > Static field / Instance field. Interface fields count as constants. The resolver and settings preview follow the whole inherit chain; .icls import maps the matching attributes. Fixes #7643
Цей коміт міститься в:
1 джерело
d62c978032
коміт
d55f116add
16 files changed
+247
-29
No files matched your search
@@ -0,0 +1,37 @@
|
||||
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(),
|
||||
],
|
||||
});
|
||||
Reference in new issue
Заблокувати користувача