Generate data files in config_gen.zig (#903)

* generate data files in config_gen.zig

* remove trailing comma from config.json

* update README.md

* run zig build gen

* handle some unclosed tags

* update data file header

* generate new data files

* remove old data file generators
This commit is contained in:
Techatrix
2023-01-19 07:46:42 +01:00
committed by GitHub
parent 6949989ece
commit fa5828496e
15 changed files with 4508 additions and 2656 deletions

View File

@@ -44,17 +44,8 @@ zig build -Drelease-safe
#### Updating Data Files
There is a `generate-data.py` in the `src/data` folder, run this file to update data files.
It writes to stdout and you can redirect output to a zig file like `master.zig`. By default it generates data file for `master`, but can be configured to generate for a different version by modifying the `zig_version` variable. Files generated by this tool **contains** formatting information.
On Powershell 5.1 (the default Powershell on Windows 10 & 11), the following will update `master.zig`.
```pwsh
New-Item -Force .\src\data\master.zig -Value ((python .\src\data\generate-data.py) -split "`r?`n" -join "`n")
```
This unweidly command is necesary in order to guarantee Unix-style line endings and UTF-8 text encoding.
There is also a `generate-data.js` in the `src/data` folder, you'll need to run this inside a Chrome DevTools console and copy the output. Files generated by this tool **does not contain** formatting information.
Run `zig build gen -- --generate-version-data master` to update data files. This command will require an internet connection.
You can replace `master` with a specific zig version like `0.10.0`. Which version ZLS uses can be configured by passing the `-Ddata_version` parameter when building ZLS.
### Configuration Options