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. Simple identifier (^[a-zA-Z][a-zA-Z0-9._-]*$): The name of an identifier, e.g. the keys in key:value pairs or the name of a variable, would also match a command name but there isn't really a good way to differentiate
  4. 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>
  5. Just highlight as mcfunction, works for command related stuff, SNBT, and JSON
Clone this wiki locally