-
Notifications
You must be signed in to change notification settings - Fork 4
Java Changelogs Syntax Highlighting
Stefan van der Velden edited this page Mar 1, 2025
·
5 revisions
The changelogs for the Java edition of Minecraft do not include any syntax highlighting, so in order to perform our own syntax highlighting we need to use some heuristics to determine what kind of highlighting to do.
The current implemented/planned heuristics are as follows, in the order they are checked:
- Special keywords:
true,false, highlight as mcfunction. These would normally be hit by the "word" case below, but are very unlikely to be used for anything other than being these keywords - Single "word" (
^[a-zA-Z_-]+$): Could be various things, so leave un-highlighted:- The name of a command, would highlight as mcfunction
- The name of a JSON/(S)NBT key, could match with the name of a command, but should highlight as an SNBT key
- A command line argument (e.g.
--renderDebugLabels), while this could easily be differentiated, the highlighting for "console" doesn't seem to highlight this any different anyway
- Folder paths/resource locations, potentially with placeholders, would like some custom highlighting for these (currently not implemented). e.g.
data/<namespace>/wolf_sound_variant/<id>.jsonand<namespace>:<id> - Tags (
^#[a-z0-9._-]+(:[a-z0-9._-]+)?$), would highlight as a comment if naively highlighted as mcfunction, need to add any command prefix in the grammar state (e.g.t) to ensure it is highlighted as a tag - Just highlight as mcfunction, works for command related stuff, SNBT, and JSON