https://github.com/phoenixr-codes/tree-sitter-mcfunction
Work in progress tree-sitter grammar for MCBE mcfunction syntax
https://github.com/phoenixr-codes/tree-sitter-mcfunction
editor-plugin mcfunction mcfunction-language minecraft minecraft-bedrock minecraft-bedrock-edition tree-sitter
Last synced: 7 days ago
JSON representation
Work in progress tree-sitter grammar for MCBE mcfunction syntax
- Host: GitHub
- URL: https://github.com/phoenixr-codes/tree-sitter-mcfunction
- Owner: phoenixr-codes
- License: mit
- Created: 2025-08-25T13:01:39.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-10-06T16:52:32.000Z (8 months ago)
- Last Synced: 2025-10-06T18:38:19.054Z (8 months ago)
- Topics: editor-plugin, mcfunction, mcfunction-language, minecraft, minecraft-bedrock, minecraft-bedrock-edition, tree-sitter
- Language: JavaScript
- Homepage:
- Size: 1.39 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
tree-sitter-mcfunction
mcfunction grammar for tree-sitter.
> [!NOTE]
> This grammar is designed for Minecraft Bedrock Edition commands and not Java
> Edition commands.
> [!IMPORTANT]
> This project is still in development. The installation process will be
> simplified as soon as the grammar is considered stable.
## Features
- ✅ **All** commands
- ✅ Good query highlights (e.g. `if` is highlighted as a conditional keyword,
`help` is highlighted as a debug keyword, ...)
- ✅ Selectors (e.g. `@a[r=3]`)
- ✅ JSON (used for "raw text" in `tellraw` and `titleraw`)
- ✅ Comments
- ✅ Markup/Formatting (e.g. `§a`)
- ✅ Emojis (e.g. `:heart:`)
## Editor Integration
> [!TIP]
> For full compability, also make sure to have Tree-sitter grammar installed for
> JSON.
```sh
git clone https://github.com/phoenixr-codes/tree-sitter-mcfunction.git
cd tree-sitter-mcfunction
```
### Neovim
> [!NOTE]
> See also:
```lua
local parsers = require("nvim-treesitter.parsers").get_parser_configs()
parsers.mcfunction = {
install_info = {
url = "https://github.com/phoenixr-codes/tree-sitter-mcfunction.git",
files = { "src/parser.c" },
branch = "main",
},
}
```
```sh
mkdir -p ~/.config/nvim/queries/mcfunction
ln queries/*.scm ~/.config/nvim/queries/mcfunction
```
### Helix
> [!IMPORTANT]
> Because Helix does not support language version 15, you need to use the
> `helix` branch.
```toml
# ~/.config/helix/languages.toml
[[grammar]]
name = "mcfunction"
source = { git = "https://github.com/phoenixr-codes/tree-sitter-mcfunction", rev = "" }
[[language]]
scope = "source.mcfunction"
name = "mcfunction"
file-types = ["mcfunction"]
roots = ["manifest.json"]
comment-token = "#"
```
```sh
hx --grammar fetch
hx --grammar build
mkdir -p ~/.config/helix/runtime/queries/mcfunction
ln queries/*.scm ~/.config/helix/runtime/queries/mcfunction
```
## References
- [Official list of commands and their syntax](https://github.com/MicrosoftDocs/minecraft-creator/tree/main/creator/Commands/commands)