Added syntax support for .mcfunction files (Minecraft functions)#3953
Added syntax support for .mcfunction files (Minecraft functions)#3953BuriXon-code wants to merge 3 commits into
Conversation
|
I would not recommend highlighting commands like In my opinion, |
|
The commands If it's a really big problem, I'll remove it. If it's just aesthetics, let it stay. |
|
Oh, okay then, I see no problem with it! |
Jenny-hso
left a comment
There was a problem hiding this comment.
I've reviewed the syntax file and have a couple of suggestions:
- I'm not quite sure whether that was an intended behaviour or not, but the rules order make tokens appear highlighted even if they are placed inside comments
Additinally, the kill command will appear highlighted as a command, even if it's a part of kill @p. I suggest placing error rules in bottom of all other rules, then consant.string, and then comment
With such approach, everything will be highlighted correctly:
- The conventional rules for string and numeric literals and the ones that I recommend using are
constant.stringandconstant.numericinstead ofstringandnumeric. AFAIK,stringandnumericare not supported by any colorscheme. Plus, you may consider changing the rule for the boolean literals toconstant.bool
|
oh, okay.. I see problems. |
|
@Jenny-hso check now :)) |
| # === DANGEROUS COMMANDS === | ||
| - error: "^\\s*(kill|tp|teleport)\\s+@([ae])(\\s|$).*$" |
There was a problem hiding this comment.
This one seems to have no effect, as it is repeated on lines 49-50. I suggest to remove it completely, while leaving the one at lines 49-50 untouched
There was a problem hiding this comment.
That junk on lines 13 and 14 is artifacts, sorry. I copied it from place to place and didn't clean it up.
I corrected numerical to number.
It should be ok :))
Thank you.
|
|
||
| # === SYMBOLS === | ||
| - symbol: "[{}\\[\\](),=]" | ||
|
|
There was a problem hiding this comment.
A blank line. Not critical, but a tiny little bit weird
| - error: "^\\s*(kill|tp|teleport)\\s+@([ae])(\\s|$).*$" | ||
|
|
||
| # === CONSTANTS === | ||
| - constant.numeric: "\\b-?[0-9]+(?:\\.[0-9]+)?\\b" |
There was a problem hiding this comment.
Sorry for being misleading in my previous review, actually the convenient rule is constant.number😅😅😅
| - constant.numeric: "\\b-?[0-9]+(?:\\.[0-9]+)?\\b" | |
| - constant.number: "\\b-?[0-9]+(?:\\.[0-9]+)?\\b" |
BTW if change constant.numeric to constant.number, it works perfectly. I really like this change
|
Everything seems okay now! I like it |


Pull Request: Add mcfunction Syntax Highlighting
Summary
This PR adds syntax highlighting support for Minecraft
.mcfunctionfiles in Micro editor.It provides better readability for datapack and command development, including commands, selectors, effects, JSON-like arguments, and numbers.
Features
effect,execute,give,tp,scoreboard, etc.) highlighted as statementsrun,if,matches,modify, etc.) highlighted separately@s,@e,@a) clearly highlightedminecraft:wither,minecraft:stone) highlighted as identifierstrue,false) highlightedkill @e,tp @e,clear @a, etc.) highlighted aserror(screaming red in most colorschemes){"text":"Hello","color":"red"}) highlighted for better readabilityMotivation
.mcfunctionfilesTesting / Examples
Example
mcfunctionsnippet highlighting all token types:effect→ statementgive→ subcommand@s→ selectorminecraft:wither→ identifier5 1) → numberstrue→ boolean / constantkill @e) → error / redNotes
.mcfunctionsyntax is added