Skip to content

Conversation

@BuriXon-code
Copy link

Pull Request: Add mcfunction Syntax Highlighting

Summary

This PR adds syntax highlighting support for Minecraft .mcfunction files in Micro editor.
It provides better readability for datapack and command development, including commands, selectors, effects, JSON-like arguments, and numbers.

Features

  • Commands (effect, execute, give, tp, scoreboard, etc.) highlighted as statements
  • Subcommands / operators (run, if, matches, modify, etc.) highlighted separately
  • Selectors (@s, @e, @a) clearly highlighted
  • Minecraft namespaces (minecraft:wither, minecraft:stone) highlighted as identifiers
  • Numbers and boolean values (true, false) highlighted
  • Dangerous commands (kill @e, tp @e, clear @a, etc.) highlighted as error (screaming red in most colorschemes)
  • JSON-like arguments ({"text":"Hello","color":"red"}) highlighted for better readability

Motivation

  • Micro lacks built-in support for .mcfunction files
  • Developers editing Minecraft datapacks, functions, and command scripts in Micro will benefit from immediate visual feedback
  • Dangerous commands and important effects are visually emphasized to prevent mistakes

Testing / Examples

Example mcfunction snippet highlighting all token types:

effect give @s minecraft:wither 5 1 true  
execute if score @s weapon_random matches 25 run item modify entity @s weapon.mainhand murder_weapon:mark25  
kill @e[type=zombie]
  • effect → statement
  • give → subcommand
  • @s → selector
  • minecraft:wither → identifier
  • Numbers (5 1) → numbers
  • true → boolean / constant
  • Dangerous commands (kill @e) → error / red

Notes

  • Only .mcfunction syntax is added
  • No changes to Micro core functionality or existing syntax files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant