Skip to content

Commit

Permalink
chore: Move assets to separate toml file
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin Blackman committed Dec 31, 2023
1 parent f5aab04 commit dbf9a1c
Show file tree
Hide file tree
Showing 9 changed files with 297 additions and 145 deletions.
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ bincode = "=1.3.3"
flate2 = "=1.0.28"
glob-match = "=0.2.1"
reqwest = { version = "=0.11.22", default-features = false, features = ["blocking", "rustls-tls-native-roots"] }
serde = { version = "=1.0.193", features = ["derive"] }
syntect = { version = "=5.1.0", default-features = false, features = ["parsing", "default-syntaxes", "plist-load", "yaml-load", "regex-onig"] }
tar = "=0.4.40"
toml = "=0.5.11"
vergen = { version = "=8.2.5", features = ["build", "git", "gitcl"] }
walkdir = { version = "=2.4.0" }

[package.metadata.bin]
cargo-about = { version = "0.6.0" }
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,12 @@ The following steps should be completed to add an editor:
#### Adding syntax highlighting for a language

Syntax highlighting language selection is a tad manual where several languages must be curated and then added to
[`build.rs`](./build.rs).
[`assets.toml`](./assets.toml).

1. Google to find a `.sublime-syntax` project on Github for your language. [bat](https://github.com/sharkdp/bat/tree/master/assets/syntaxes/02_Extra) has many!
2. Update the `get_syntaxes()` function in [`build.rs`](./build.rs) to include the new repo. Make sure to set the URL to
a commit locked `.tar.gz` file, and to include the license in the files vector.
2. Update [`assets.toml`](./assets.toml) to include the new repo. Make sure to include the license in the files array.
You can leave `nix-hash` as an empty string, and it'll be updated by a maintainer later. Or if you have docker
installed, you can run `cargo xtask hash-assets`.
3. `rm -rf .caches && cargo build`
4. Test to see highlighting works.

Expand Down
93 changes: 93 additions & 0 deletions assets.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# [[syntaxes]] OR [[themes]]

# Github account name that owns the repo.
# owner = ""

# Github repository name
# repo = ""

# Git revision to lock to.
# rev = ""

# Glob patterns matching selected files. Be sure to include all licenses!
# files = ["LICENSE", "*/LICENSE", "*/LICENSE.*", "*/*.sublime-syntax"]

# Nix hash for the git revision archive. This is generated by running `cargo xtash hash-assets.`
# nix-hash = ""

[[syntaxes]]
owner = "sublimehq"
repo = "Packages"
rev = "759d6eed9b4beed87e602a23303a121c3a6c2fb3"
files = ["LICENSE", "*/LICENSE", "*/LICENSE.*", "*/*.sublime-syntax"]
nix-hash = "sha256-0qadXgGwa3RxUxa6RAQWg933oFvJooWtK7BUx8RwAy0="

[[syntaxes]]
owner = "sharkdp"
repo = "bat"
rev = "7658334645936d2a956fb19aa96e6fca849cb754"
files = ["LICENSE-MIT", "assets/syntaxes/02_Extra/*.sublime-syntax"]
nix-hash = "sha256-4IFtaji8ymuGSE1OeMC9by8OJVhbrXXlgkQlusrAAIs="

[[syntaxes]]
owner = "dncrews"
repo = "GraphQL-SublimeText3"
rev = "9b6f6d0a86d7e7ef1d44490b107472af7fb4ffaf"
files = ["LICENSE", "*.sublime-syntax"]
nix-hash = "sha256-PTM61P5dObqR0hdMZIg5bXxinPPFQNFm61WiDxXiP2M="

[[syntaxes]]
owner = "VcamX"
repo = "protobuf-syntax-highlighting"
rev = "726e21d74dac23cbb036f2fbbd626decdc954060"
files = ["LICENSE", "*.sublime-syntax"]
nix-hash = "sha256-kYVvcz4kTWZTrjaJzdsbO5chhN56fvu4iD6Y0E5Dj68="

[[syntaxes]]
owner = "ziglang"
repo = "sublime-zig-language"
rev = "1a4a38445fec495817625bafbeb01e79c44abcba"
files = ["LICENSE", "Syntaxes/*.sublime-syntax"]
nix-hash = "sha256-buQKVIBcwicTFjmtkIDiy6VjkOlKXep47Ol5hk6eNlo="

[[syntaxes]]
owner = "alexlouden"
repo = "Terraform.tmLanguage"
rev = "54d8350c3c5929c921ea7561c932aa15e7d96c48"
files = ["LICENSE", "*.sublime-syntax"]
nix-hash = "sha256-cV8eqSi4AkG3JpeJaOV78V6Mg2RHPL7KuJS8+F8rRDI="

[[syntaxes]]
owner = "jasonwilliams"
repo = "sublime_toml_highlighting"
rev = "fd0bf3e5d6c9e6397c0dc9639a0514d9bf55b800"
files = ["LICENSE", "*.sublime-syntax"]
nix-hash = "sha256-/9RCQNWpp2j/u4o6jBCPN3HEuuR4ow3h+0Zj+Cbteyc="

[[syntaxes]]
owner = "princemaple"
repo = "elixir-sublime-syntax"
rev = "4fb01891dd17434dde42887bc821917a30f4e010"
files = ["LICENSE", "*.sublime-syntax"]
nix-hash = "sha256-R1e6RjirSsCx3uZoEOPpj5/NXZ2Gw48IyHOFW/7GOmY="

[[syntaxes]]
owner = "digitalcora"
repo = "sublime-text-gleam"
rev = "0b032f78c9c4aec1c598da1d25c67ca21fa8c381"
files = ["LICENSE", "package/*.sublime-syntax"]
nix-hash = "sha256-5QHjrik+RozACSRuuC9ltM3qHYFh5CdQZuJXJO/EWBQ="

[[themes]]
owner = "chriskempson"
repo = "base16-textmate"
rev = "0e51ddd568bdbe17189ac2a07eb1c5f55727513e"
files = [
"LICENSE.md",
"Themes/base16-github.tmTheme",
"Themes/base16-monokai.tmTheme",
"Themes/base16-one-light.tmTheme",
"Themes/base16-onedark.tmTheme",
"Themes/base16-seti.tmTheme",
]
nix-hash = "sha256-reYGXrhhHNSp/1k6YJ2hxj4jnJQCDgy2Nzxse2PviTA="

0 comments on commit dbf9a1c

Please sign in to comment.