Skip to content

Java Changelogs Syntax Highlighting

Stefan van der Velden edited this page Mar 7, 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:

  1. 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
  2. Special keywords: true, false, highlight as mcfunction. These would normally be hit by the key case below, but are very unlikely to be used for anything other than being these keywords
  3. Potential command name (^[a-z]+): Would be caught by the key case below, but should be highlighted as mcfunction as there's a decent chance it is a command name
  4. Single key (^[a-zA-Z][a-zA-Z0-9._-]*$): The name of a JSON/(S)NBT key
  5. 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>.json and <namespace>:<id>
  6. Just highlight as mcfunction, works for command related stuff, SNBT, and JSON

Clone this wiki locally