Skip to content

Commit b831afb

Browse files
committed
docs: update README
1 parent 478eae2 commit b831afb

File tree

3 files changed

+240
-59
lines changed

3 files changed

+240
-59
lines changed

.github/workflows/publish.yml

+17-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
paths:
77
- "mcfunction.*"
88
push:
9-
branches: [main]
109
tags: ["v*.*.*"]
1110

1211
jobs:
@@ -15,7 +14,7 @@ jobs:
1514

1615
steps:
1716
# ---------------------------------------------
18-
# ----- gather repo -----
17+
# ---- gather repo -----
1918
# ---------------------------------------------
2019
- uses: actions/checkout@v3
2120
with:
@@ -29,7 +28,7 @@ jobs:
2928
run: git checkout main
3029

3130
# ---------------------------------------------
32-
# ----- setup deps -----
31+
# ---- setup deps -----
3332
# ---------------------------------------------
3433
- name: Use Node.js ${{ matrix.node-version }}
3534
uses: actions/setup-node@v3
@@ -42,6 +41,7 @@ jobs:
4241
npm install -g @vscode/vsce
4342
npm install -g js-yaml
4443
npm install -g ovsx
44+
npm install -g plist2
4545
4646
- name: "Setup jq"
4747
uses: dcarbone/install-jq-action@v2
@@ -50,10 +50,12 @@ jobs:
5050
force: true
5151

5252
# ---------------------------------------------
53-
# ----- generate files -----
53+
# ---- generate files -----
5454
# ---------------------------------------------
55-
- name: Export JSON from YAML
56-
run: js-yaml mcfunction.tmLanguage.yaml > mcfunction.tmLanguage.json
55+
- name: Export YAML -> JSON -> PLIST
56+
run: |
57+
js-yaml mcfunction.tmLanguage.yaml > mcfunction.tmLanguage.json
58+
plist2 mcfunction.tmLanguage.json mcfunction.tmLanguage
5759
5860
- id: version
5961
name: Version
@@ -63,15 +65,15 @@ jobs:
6365
echo "ext=syntax-mcfunction-$VERSION.vsix" >> "$GITHUB_OUTPUT"
6466
6567
# ---------------------------------------------
66-
# ----- push files -----
68+
# ---- push files -----
6769
# ---------------------------------------------
6870
- name: Push JSON to repo for sublime (if not matched)
6971
if: github.ref == 'refs/heads/main'
7072
run: |
7173
git config --global user.name "github-actions"
7274
git config --global user.email "[email protected]"
73-
git add mcfunction.tmLanguage.json
74-
git commit -m "🤖 Generate JSON"
75+
git add mcfunction.tmLanguage.json mcfunction.tmLanguage
76+
git commit -m "🤖 Generate JSON/PLIST"
7577
git push origin main
7678
continue-on-error: true
7779

@@ -83,11 +85,11 @@ jobs:
8385
git config --global user.name "github-actions"
8486
git config --global user.email "[email protected]"
8587
git add package.json
86-
git commit -m "🤖 Bump version"
88+
git commit -m "🎉 Release ${{ steps.version.outputs.v }}"
8789
git push origin main
8890
8991
# ---------------------------------------------
90-
# ----- release -----
92+
# ---- release -----
9193
# ---------------------------------------------
9294
- id: package
9395
name: Package VSCode Ext
@@ -112,6 +114,10 @@ jobs:
112114
mcfunction.tmLanguage.yaml
113115
mcfunction.tmLanguage.json
114116
117+
- name: Release to vsce
118+
if: startsWith(github.ref, 'refs/tags/')
119+
run: vsce publish
120+
115121
- name: Release to openvsix
116122
if: startsWith(github.ref, 'refs/tags/')
117123
run: npx ovsx publish ${{ steps.version.outputs.ext }} -p ${{ secrets.OVSX }}

README.md

+36-12
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,21 @@ Give this repo a ⭐ if you like it!
1010

1111
![demo](https://raw.githubusercontent.com/MinecraftCommands/syntax-mcfunction/main/imgs/preview.png)
1212

13-
## Goals
13+
This project contains syntax definitions for Minecraft commands (`.mcfunction`) using the textmate grammer spec. It is a general, feature complete language spec built via generic syntatical components that describe the language (aka, mimimal hardcoded command support). This means it should support future game versions, many modded commands, and even custom language compilers such as [bolt](https://github.com/mcbeet/bolt) and [jmc](https://jmc.wingedseal.com/).
1414

15-
The aim of this syntax definition is to provide a general, feature complete language spec for Minecraft commands. It is **not** geared towards error checking or the specific commands and specifically contains **zero** error highlighting, allowing for decent highlighting of invalid or custom pre-processed command scripts.
16-
17-
## TODOs
18-
19-
- [x] Add explicit macro support
20-
- [x] Fix issues with nbt and other suffixes on numbrs
21-
- [x] Fix issues on resource names versus keywords
22-
- [ ] Add tests for Bedrock
23-
- [ ] (VSCode & Sublime) Add jsonschema file for `pack.mcmeta`
24-
- [-] Compare w/ `language-mcfunction` to synchronize scope names
25-
- Likely won't get better than this tbh, will need feedback
15+
> [!Warning]
16+
> This syntax does **not** contain any error highlighting meaning invalid commands will highlight correctly. If you are looking error validation and auto-complete for vanilla commands, we recommend the [Spyglass](https://spyglassmc.com/) project for a language-server that builds upon this simple grammar!
2617
2718
## Installing
2819

2920
### [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=MinecraftCommands.syntax-mcfunction)
3021

3122
Install the extension from the [marketplace](https://marketplace.visualstudio.com/items?itemName=MinecraftCommands.syntax-mcfunction) or by searching for `syntax-mcfunction` in the extensions tab.
3223

24+
### [open-vsix Extension](https://open-vsx.org/extension/MinecraftCommands/syntax-mcfunction)
25+
26+
Follow these [instructions](https://github.com/eclipse/openvsx/wiki/Using-Open-VSX-in-VS-Code) if you are looking on using the open-vsix version of this project in VSCode or any of it's forks.
27+
3328
### Sublime Text
3429

3530
It is recommended you use [Package Control](https://packagecontrol.io/) to manage the package:
@@ -49,6 +44,22 @@ This will keep the package updated with the repository automatically.
4944

5045
Otherwise you can clone the repository into user packages (e.g. `%appdata%\Sublime Text 3\Packages`) and update it manually.
5146

47+
## `language-mcfunction`
48+
49+
While this grammar was created from scratch, much of it's work was adapted from the original [`language-mcfunction`](https://github.com/arcensoth/language-mcfunction) grammar. One of the original ideas for `language-mcfunction` was to develop a general, simpler version for `mcfunction`.
50+
51+
> [!Note]
52+
> Actually, an earlier prototype of this grammar was going to be used as a base for a `language-mcfunction` rewrite.
53+
54+
There are some key differences to note between this syntax and the original:
55+
- `language-mcfunction` is designed to operate on singular lines. If one line is broken, it does not affect lines after it and commands **cannot** span across multiple lines at all.
56+
- This was the core issue that caused me to develop `syntax-mcfunction` (even before Minecraft 1.20.2 introduced multi-line commands) as I needed a grammar that had multi-line support.
57+
- `language-mcfunction` contains specific commands validation and reports errors for invalid commands
58+
- `syntax-mcfunction` differs in philosophy here. Textmate grammars are not well-equipped to actually validate commands — that's more of a role for language servers.
59+
- This project also generally highlights commands as it allows for easier maintenance and is better for platforms such as Github where multiple command extensions / modded commands might reuse the `.mcfunction` extension.
60+
61+
Due to these, coloring and highlighting will vary in a couple of places when comparing these grammars. While the goal is to match `language-mcfunction` as close as possible, there will never be a true 1:1 match in highlighting as the entire design of the grammar differs.
62+
5263
## Contributing
5364

5465
We are happy to accept any PRs just make sure to make a cooresponding issue first to track it. When making a PR, make sure the branch of your fork is **not** `main` and also make sure maintainers are allowed to edit your PR. This is helpful for me making small edits to the PR before merging.
@@ -59,6 +70,19 @@ We only require edits to the `yaml` file as the `json` and `plist` files are gen
5970
npx js-yaml mcfunction.tmLanguage.yaml > mcfunction.tmLanguage.json
6071
```
6172

73+
### Making Releases
74+
75+
Releases are semi-automated in this repo. Once your PR is merged into the `main` branch, the maintainer will create a new tag to trigger our Github CI to produce a new version.
76+
77+
```bash
78+
git tag -a v1.2.3
79+
git push --tags
80+
```
81+
82+
This will generate the json and plist variations of the grammar, create and push a `.vsix` extension to the VSCode and open-vsix marketplaces, and create a release in the [releases](https://github.com/MinecraftCommands/syntax-mcfunction/releases) tab.
83+
84+
The maintainer will then need to manually fill in the body of the release to add in the changelog and links.
85+
6286
## Acknowledgements
6387

6488
This repo is entirely dedicated to our beloved community member and friend, [Arcensoth](https://github.com/Arcensoth). His work on the original [language-mcfunction](https://github.com/Arcensoth/language-mcfunction) and overall contributions to the Minecraft Commands community was invaluable and he will be missed.

0 commit comments

Comments
 (0)