mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
Compare commits
79 Commits
897de69d01
...
d6a75bd14c
Author | SHA1 | Date | |
---|---|---|---|
|
d6a75bd14c | ||
|
b8313da5a8 | ||
|
32ff0fce4a | ||
|
9e171e7d1d | ||
|
b92e8abfb3 | ||
|
8807dbfc40 | ||
|
15b478d433 | ||
|
467fad51b1 | ||
|
b855cd0cda | ||
|
6101b3a7a3 | ||
|
887bbbc375 | ||
|
7ee66c0658 | ||
|
843c058f0b | ||
|
ed7e5bd8dc | ||
|
b501a300e9 | ||
|
310bc04f23 | ||
|
2f6a113fbe | ||
|
8c6ca3c0fc | ||
|
b97c745631 | ||
|
d8e2aab201 | ||
|
188f701f50 | ||
|
83f1b98e80 | ||
|
4dc46f9472 | ||
|
4d0b7e57b1 | ||
|
548fd57489 | ||
|
8ed8d52e9d | ||
|
eeb5b7bbdd | ||
|
d95b21ddd3 | ||
|
56bb366f7e | ||
|
06d5b88dee | ||
|
e2d79c1891 | ||
|
5b3e0b64f0 | ||
|
07262f5170 | ||
|
6ec510d58f | ||
|
4d3612125b | ||
|
f9ac1f1ff1 | ||
|
2dbecd3c80 | ||
|
aa10b1fd11 | ||
|
07968880e6 | ||
|
4e2faa0be9 | ||
|
0fca0d057e | ||
|
68ee87695b | ||
|
b6e555a2ed | ||
|
48e15f77f7 | ||
|
59b020ec91 | ||
|
239262e094 | ||
|
23600e3ecb | ||
|
287e412780 | ||
|
bc18dc2c0c | ||
|
3fd7ca334e | ||
|
6373027c9e | ||
|
f06f481ad9 | ||
|
a219d5aabb | ||
|
d489c03c4f | ||
|
f621423e7d | ||
|
35802cb025 | ||
|
d15fab75ea | ||
|
f3a46c8751 | ||
|
400a1930ad | ||
|
8caba39b05 | ||
|
b13999952f | ||
|
b7656e0079 | ||
|
1231429028 | ||
|
29b4a2f042 | ||
|
67baa536ec | ||
|
bbdebe9d72 | ||
|
c6645d4d8f | ||
|
aad5f6a5e2 | ||
|
0fbfc0cc8d | ||
|
de0618186c | ||
|
44605c4dce | ||
|
974303e200 | ||
|
bd9cfbb61d | ||
|
951b454a33 | ||
|
0364f7c879 | ||
|
132d388444 | ||
|
96688a5915 | ||
|
c75179d921 | ||
|
0b5f0d606a |
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ target
|
||||
helix-term/rustfmt.toml
|
||||
result
|
||||
runtime/grammars
|
||||
.DS_Store
|
||||
|
134
Cargo.lock
generated
134
Cargo.lock
generated
@ -136,9 +136,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.1.37"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40545c26d092346d8a8dab71ee48e7685a7a9cba76e634790c215b41a4a7b4cf"
|
||||
checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
@ -383,7 +383,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7199d965852c3bac31f779ef99cbb4537f80e952e2d6aa0ffeb30cce00f4f46e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
@ -522,7 +522,7 @@ dependencies = [
|
||||
"gix-worktree",
|
||||
"once_cell",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -535,7 +535,7 @@ dependencies = [
|
||||
"gix-date",
|
||||
"gix-utils",
|
||||
"itoa",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
@ -552,7 +552,7 @@ dependencies = [
|
||||
"gix-trace",
|
||||
"kstring",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
"unicode-bom",
|
||||
]
|
||||
|
||||
@ -562,7 +562,7 @@ version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10f78312288bd02052be5dbc2ecbc342c9f4eb791986d86c0a5c06b92dc72efa"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -571,7 +571,7 @@ version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c28b58ba04f0c004722344390af9dbc85888fbb84be1981afb934da4114d4cf"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -597,7 +597,7 @@ dependencies = [
|
||||
"gix-features",
|
||||
"gix-hash",
|
||||
"memmap2",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -616,7 +616,7 @@ dependencies = [
|
||||
"memchr",
|
||||
"once_cell",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
"unicode-bom",
|
||||
"winnow",
|
||||
]
|
||||
@ -631,7 +631,7 @@ dependencies = [
|
||||
"bstr",
|
||||
"gix-path",
|
||||
"libc",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -643,7 +643,7 @@ dependencies = [
|
||||
"bstr",
|
||||
"itoa",
|
||||
"jiff",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -664,7 +664,7 @@ dependencies = [
|
||||
"gix-traverse",
|
||||
"gix-worktree",
|
||||
"imara-diff",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -684,7 +684,7 @@ dependencies = [
|
||||
"gix-trace",
|
||||
"gix-utils",
|
||||
"gix-worktree",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -700,7 +700,7 @@ dependencies = [
|
||||
"gix-path",
|
||||
"gix-ref",
|
||||
"gix-sec",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -718,7 +718,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"prodash",
|
||||
"sha1_smol",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
@ -740,7 +740,7 @@ dependencies = [
|
||||
"gix-trace",
|
||||
"gix-utils",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -773,7 +773,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "952c3a29f1bc1007cc901abce7479943abfa42016db089de33d0a4fa3c85bfe8"
|
||||
dependencies = [
|
||||
"faster-hex",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -825,7 +825,7 @@ dependencies = [
|
||||
"memmap2",
|
||||
"rustix",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -836,7 +836,7 @@ checksum = "5102acdf4acae2644e38dbbd18cdfba9597a218f7d85f810fe5430207e03c2de"
|
||||
dependencies = [
|
||||
"gix-tempfile",
|
||||
"gix-utils",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -855,7 +855,7 @@ dependencies = [
|
||||
"gix-validate",
|
||||
"itoa",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
@ -877,7 +877,7 @@ dependencies = [
|
||||
"gix-quote",
|
||||
"parking_lot",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -895,7 +895,7 @@ dependencies = [
|
||||
"gix-path",
|
||||
"memmap2",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -907,7 +907,7 @@ dependencies = [
|
||||
"bstr",
|
||||
"faster-hex",
|
||||
"gix-trace",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -920,7 +920,7 @@ dependencies = [
|
||||
"gix-trace",
|
||||
"home",
|
||||
"once_cell",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -935,7 +935,7 @@ dependencies = [
|
||||
"gix-config-value",
|
||||
"gix-glob",
|
||||
"gix-path",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -946,7 +946,7 @@ checksum = "f89f9a1525dcfd9639e282ea939f5ab0d09d93cf2b90c1fc6104f1b9582a8e49"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"gix-utils",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -966,7 +966,7 @@ dependencies = [
|
||||
"gix-utils",
|
||||
"gix-validate",
|
||||
"memmap2",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
@ -981,7 +981,7 @@ dependencies = [
|
||||
"gix-revision",
|
||||
"gix-validate",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -996,7 +996,7 @@ dependencies = [
|
||||
"gix-hash",
|
||||
"gix-object",
|
||||
"gix-revwalk",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1011,7 +1011,7 @@ dependencies = [
|
||||
"gix-hashtable",
|
||||
"gix-object",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1046,7 +1046,7 @@ dependencies = [
|
||||
"gix-pathspec",
|
||||
"gix-worktree",
|
||||
"portable-atomic",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1061,7 +1061,7 @@ dependencies = [
|
||||
"gix-pathspec",
|
||||
"gix-refspec",
|
||||
"gix-url",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1098,7 +1098,7 @@ dependencies = [
|
||||
"gix-object",
|
||||
"gix-revwalk",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1110,7 +1110,7 @@ dependencies = [
|
||||
"bstr",
|
||||
"gix-features",
|
||||
"gix-path",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
"url",
|
||||
]
|
||||
|
||||
@ -1132,7 +1132,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e187b263461bc36cea17650141567753bc6207d036cedd1de6e81a52f277ff68"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1263,7 +1263,7 @@ dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
@ -1319,7 +1319,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"slotmap",
|
||||
"thiserror",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
]
|
||||
@ -1392,7 +1392,7 @@ dependencies = [
|
||||
"smallvec",
|
||||
"tempfile",
|
||||
"termini",
|
||||
"thiserror",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"toml",
|
||||
@ -1459,7 +1459,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"slotmap",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"thiserror 2.0.3",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"toml",
|
||||
@ -1755,9 +1755,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.162"
|
||||
version = "0.2.164"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398"
|
||||
checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
@ -1911,9 +1911,9 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||
|
||||
[[package]]
|
||||
name = "open"
|
||||
version = "5.3.0"
|
||||
version = "5.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61a877bf6abd716642a53ef1b89fb498923a4afca5c754f9050b4d081c05c4b3"
|
||||
checksum = "3ecd52f0b8d15c40ce4820aa251ed5de032e5d91fab27f7db2f40d42a8bdf69c"
|
||||
dependencies = [
|
||||
"is-wsl",
|
||||
"libc",
|
||||
@ -2128,9 +2128,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.40"
|
||||
version = "0.38.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0"
|
||||
checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
@ -2182,9 +2182,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.132"
|
||||
version = "1.0.133"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03"
|
||||
checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
@ -2398,18 +2398,38 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.64"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
"thiserror-impl 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa"
|
||||
dependencies = [
|
||||
"thiserror-impl 2.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.64"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
|
||||
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "2.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2551,9 +2571,9 @@ checksum = "7eec5d1121208364f6793f7d2e222bf75a915c19557537745b195b253dd64217"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-general-category"
|
||||
version = "0.6.0"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2281c8c1d221438e373249e065ca4989c4c36952c211ff21a0ee91c44a3869e7"
|
||||
checksum = "24adfe8311434967077a6adff125729161e6e4934d76f6b7c55318ac5c9246d3"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
@ -2691,9 +2711,9 @@ checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "6.0.3"
|
||||
version = "7.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f"
|
||||
checksum = "c9cad3279ade7346b96e38731a641d7343dd6a53d55083dd54eadfa5a1b38c6b"
|
||||
dependencies = [
|
||||
"either",
|
||||
"home",
|
||||
|
@ -41,7 +41,7 @@ package.helix-term.opt-level = 2
|
||||
tree-sitter = { version = "0.22" }
|
||||
nucleo = "0.5.0"
|
||||
slotmap = "1.0.7"
|
||||
thiserror = "1.0"
|
||||
thiserror = "2.0"
|
||||
|
||||
[workspace.package]
|
||||
version = "24.7.0"
|
||||
|
@ -117,7 +117,7 @@ #### Note to packagers
|
||||
script could follow are:
|
||||
|
||||
1. `export HELIX_DEFAULT_RUNTIME=/usr/lib/helix/runtime`
|
||||
1. `cargo build --profile opt --locked --path helix-term`
|
||||
1. `cargo build --profile opt --locked`
|
||||
1. `cp -r runtime $BUILD_DIR/usr/lib/helix/`
|
||||
1. `cp target/opt/hx $BUILD_DIR/usr/bin/hx`
|
||||
|
||||
|
@ -27,8 +27,8 @@ # Configuration
|
||||
|
||||
You can use a custom configuration file by specifying it with the `-c` or
|
||||
`--config` command line argument, for example `hx -c path/to/custom-config.toml`.
|
||||
Additionally, you can reload the configuration file by sending the USR1
|
||||
signal to the Helix process on Unix operating systems, such as by using the command `pkill -USR1 hx`.
|
||||
You can reload the config file by issuing the `:config-reload` command. Alternatively, on Unix operating systems, you can reload it by sending the USR1
|
||||
signal to the Helix process, such as by using the command `pkill -USR1 hx`.
|
||||
|
||||
Finally, you can have a `config.toml` local to a project by putting it under a `.helix` directory in your repository.
|
||||
Its settings will be merged with the configuration directory `config.toml` and the built-in configuration.
|
||||
|
@ -24,6 +24,7 @@ ### `[editor]` Section
|
||||
|--|--|---------|
|
||||
| `scrolloff` | Number of lines of padding around the edge of the screen when scrolling | `5` |
|
||||
| `mouse` | Enable mouse mode | `true` |
|
||||
| `default-yank-register` | Default register used for yank/paste | `"` |
|
||||
| `middle-click-paste` | Middle click paste support | `true` |
|
||||
| `scroll-lines` | Number of lines to scroll per scroll wheel step | `3` |
|
||||
| `shell` | Shell to use when running external commands | Unix: `["sh", "-c"]`<br/>Windows: `["cmd", "/C"]` |
|
||||
@ -52,6 +53,30 @@ ### `[editor]` Section
|
||||
| `indent-heuristic` | How the indentation for a newly inserted line is computed: `simple` just copies the indentation level from the previous line, `tree-sitter` computes the indentation based on the syntax tree and `hybrid` combines both approaches. If the chosen heuristic is not available, a different one will be used as a fallback (the fallback order being `hybrid` -> `tree-sitter` -> `simple`). | `hybrid`
|
||||
| `jump-label-alphabet` | The characters that are used to generate two character jump labels. Characters at the start of the alphabet are used first. | `"abcdefghijklmnopqrstuvwxyz"`
|
||||
| `end-of-line-diagnostics` | Minimum severity of diagnostics to render at the end of the line. Set to `disable` to disable entirely. Refer to the setting about `inline-diagnostics` for more details | "disable"
|
||||
| `clipboard-provider` | Which API to use for clipboard interaction. One of `pasteboard` (MacOS), `wayland`, `x-clip`, `x-sel`, `win-32-yank`, `termux`, `tmux`, `windows`, `termcode`, `none`, or a custom command set. | Platform and environment specific. |
|
||||
|
||||
### `[editor.clipboard-provider]` Section
|
||||
|
||||
Helix can be configured wither to use a builtin clipboard configuration or to use
|
||||
a provided command.
|
||||
|
||||
For instance, setting it to use OSC 52 termcodes, the configuration would be:
|
||||
```toml
|
||||
[editor]
|
||||
clipboard-provider = "termcode"
|
||||
```
|
||||
|
||||
Alternatively, Helix can be configured to use arbitary commands for clipboard integration:
|
||||
|
||||
```toml
|
||||
[editor.clipboard-provider.custom]
|
||||
yank = { command = "cat", args = ["test.txt"] }
|
||||
paste = { command = "tee", args = ["test.txt"] }
|
||||
primary-yank = { command = "cat", args = ["test-primary.txt"] } # optional
|
||||
primary-paste = { command = "tee", args = ["test-primary.txt"] } # optional
|
||||
```
|
||||
|
||||
For custom commands the contents of the yank/paste is communicated over stdin/stdout.
|
||||
|
||||
### `[editor.statusline]` Section
|
||||
|
||||
@ -428,7 +453,8 @@ ### `[editor.inline-diagnostics]` Section
|
||||
|
||||
The new diagnostic rendering is not yet enabled by default. As soon as end of line or inline diagnostics are enabled the old diagnostics rendering is automatically disabled. The recommended default setting are:
|
||||
|
||||
```
|
||||
```toml
|
||||
[editor]
|
||||
end-of-line-diagnostics = "hint"
|
||||
[editor.inline-diagnostics]
|
||||
cursor-line = "warning" # show warnings and errors on the cursorline inline
|
||||
|
@ -91,7 +91,7 @@
|
||||
| hosts | ✓ | | | |
|
||||
| html | ✓ | | | `vscode-html-language-server`, `superhtml` |
|
||||
| hurl | ✓ | ✓ | ✓ | |
|
||||
| hyprlang | ✓ | | ✓ | |
|
||||
| hyprlang | ✓ | | ✓ | `hyprls` |
|
||||
| idris | | | | `idris2-lsp` |
|
||||
| iex | ✓ | | | |
|
||||
| ini | ✓ | | | |
|
||||
@ -136,6 +136,7 @@
|
||||
| move | ✓ | | | |
|
||||
| msbuild | ✓ | | ✓ | |
|
||||
| nasm | ✓ | ✓ | | |
|
||||
| nestedtext | ✓ | ✓ | ✓ | |
|
||||
| nickel | ✓ | | ✓ | `nls` |
|
||||
| nim | ✓ | ✓ | ✓ | `nimlangserver` |
|
||||
| nix | ✓ | ✓ | | `nil`, `nixd` |
|
||||
@ -168,6 +169,7 @@
|
||||
| purescript | ✓ | ✓ | | `purescript-language-server` |
|
||||
| python | ✓ | ✓ | ✓ | `ruff`, `jedi-language-server`, `pylsp` |
|
||||
| qml | ✓ | | ✓ | `qmlls` |
|
||||
| quint | ✓ | | | `quint-language-server` |
|
||||
| r | ✓ | | | `R` |
|
||||
| racket | ✓ | | ✓ | `racket` |
|
||||
| regex | ✓ | | | |
|
||||
@ -189,6 +191,7 @@
|
||||
| sml | ✓ | | | |
|
||||
| snakemake | ✓ | | ✓ | `pylsp` |
|
||||
| solidity | ✓ | ✓ | | `solc` |
|
||||
| spade | ✓ | | ✓ | `spade-language-server` |
|
||||
| spicedb | ✓ | | | |
|
||||
| sql | ✓ | ✓ | | |
|
||||
| sshclientconfig | ✓ | | | |
|
||||
@ -204,6 +207,7 @@
|
||||
| task | ✓ | | | |
|
||||
| tcl | ✓ | | ✓ | |
|
||||
| templ | ✓ | | | `templ` |
|
||||
| textproto | ✓ | ✓ | ✓ | |
|
||||
| tfvars | ✓ | | ✓ | `terraform-ls` |
|
||||
| thrift | ✓ | | | |
|
||||
| todotxt | ✓ | | | |
|
||||
@ -215,7 +219,7 @@
|
||||
| typespec | ✓ | ✓ | ✓ | `tsp-server` |
|
||||
| typst | ✓ | | | `tinymist`, `typst-lsp` |
|
||||
| ungrammar | ✓ | | | |
|
||||
| unison | ✓ | | ✓ | |
|
||||
| unison | ✓ | ✓ | ✓ | |
|
||||
| uxntal | ✓ | | | |
|
||||
| v | ✓ | ✓ | ✓ | `v-analyzer` |
|
||||
| vala | ✓ | ✓ | | `vala-language-server` |
|
||||
|
@ -146,6 +146,7 @@ ### Selection manipulation
|
||||
| `Alt-p`, `Alt-left` | Select previous sibling node in syntax tree (**TS**) | `select_prev_sibling` |
|
||||
| `Alt-n`, `Alt-right` | Select next sibling node in syntax tree (**TS**) | `select_next_sibling` |
|
||||
| `Alt-a` | Select all sibling nodes in syntax tree (**TS**) | `select_all_siblings` |
|
||||
| `Alt-I`, `Alt-Shift-down`| Select all children nodes in syntax tree (**TS**) | `select_all_children` |
|
||||
| `Alt-e` | Move to end of parent node in syntax tree (**TS**) | `move_parent_node_end` |
|
||||
| `Alt-b` | Move to start of parent node in syntax tree (**TS**) | `move_parent_node_start` |
|
||||
|
||||
@ -281,7 +282,7 @@ #### Space mode
|
||||
|
||||
| Key | Description | Command |
|
||||
| ----- | ----------- | ------- |
|
||||
| `f` | Open file picker | `file_picker` |
|
||||
| `f` | Open file picker at LSP workspace root | `file_picker` |
|
||||
| `F` | Open file picker at current working directory | `file_picker_in_current_directory` |
|
||||
| `b` | Open buffer picker | `buffer_picker` |
|
||||
| `j` | Open jumplist picker | `jumplist_picker` |
|
||||
|
@ -102,6 +102,14 @@ ### AppImage
|
||||
./helix-*.AppImage # run helix
|
||||
```
|
||||
|
||||
You can optionally [add the `.desktop` file](./building-from-source.md#configure-the-desktop-shortcut). Helix must be installed in `PATH` with the name `hx`. For example:
|
||||
```sh
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
mv helix-*.AppImage "$HOME/.local/bin/hx"
|
||||
```
|
||||
|
||||
and make sure `~/.local/bin` is in your `PATH`.
|
||||
|
||||
## macOS
|
||||
|
||||
### Homebrew Core
|
||||
|
@ -4,10 +4,31 @@ ## Key remapping
|
||||
file. (More powerful solutions such as rebinding via commands will be
|
||||
available in the future).
|
||||
|
||||
There are three kinds of commands that can be used in keymaps:
|
||||
|
||||
* Static commands: commands like `move_char_right` which are usually bound to
|
||||
keys and used for movement and editing. A list of static commands is
|
||||
available in the [Keymap](./keymap.html) documentation and in the source code
|
||||
in [`helix-term/src/commands.rs`](https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs)
|
||||
at the invocation of `static_commands!` macro.
|
||||
* Typable commands: commands that can be executed from command mode (`:`), for
|
||||
example `:write!`. See the [Commands](./commands.html) documentation for a
|
||||
list of available typeable commands or the `TypableCommandList` declaration in
|
||||
the source code at [`helix-term/src/commands/typed.rs`](https://github.com/helix-editor/helix/blob/master/helix-term/src/commands/typed.rs).
|
||||
* Macros: sequences of keys that are executed in order. These keybindings
|
||||
start with `@` and then list any number of keys to be executed. For example
|
||||
`@miw` can be used to select the surrounding word. For now, macro keybindings
|
||||
are not allowed in keybinding sequences due to limitations in the way that
|
||||
command sequences are executed. Modifier keys (e.g. Alt+o) can be used
|
||||
like `"<A-o>"`, e.g. `"@miw<A-o>"`
|
||||
|
||||
To remap keys, create a `config.toml` file in your `helix` configuration
|
||||
directory (default `~/.config/helix` on Linux systems) with a structure like
|
||||
this:
|
||||
|
||||
> 💡 To set a modifier + key as a keymap, type `A-X = ...` or `C-X = ...` for Alt + X or Ctrl + X. Combine with Shift using a dash, e.g. `C-S-esc`.
|
||||
> Within macros, wrap them in `<>`, e.g. `<A-X>` and `<C-X>` to distinguish from the `A` or `C` keys.
|
||||
|
||||
```toml
|
||||
# At most one section each of 'keys.normal', 'keys.insert' and 'keys.select'
|
||||
[keys.normal]
|
||||
@ -18,6 +39,7 @@ # At most one section each of 'keys.normal', 'keys.insert' and 'keys.select'
|
||||
"C-S-esc" = "extend_line" # Maps Ctrl-Shift-Escape to extend_line
|
||||
g = { a = "code_action" } # Maps `ga` to show possible code actions
|
||||
"ret" = ["open_below", "normal_mode"] # Maps the enter key to open_below then re-enter normal mode
|
||||
"A-x" = "@x<A-d>" # Maps Alt-x to a macro selecting the whole line and deleting it without yanking it
|
||||
|
||||
[keys.insert]
|
||||
"A-x" = "normal_mode" # Maps Alt-X to enter normal mode
|
||||
@ -74,21 +96,3 @@ ## Special keys and modifiers
|
||||
| Escape | `"esc"` |
|
||||
|
||||
Keys can be disabled by binding them to the `no_op` command.
|
||||
|
||||
## Commands
|
||||
|
||||
There are three kinds of commands that can be used in keymaps:
|
||||
|
||||
* Static commands: commands like `move_char_right` which are usually bound to
|
||||
keys and used for movement and editing. A list of static commands is
|
||||
available in the [Keymap](./keymap.html) documentation and in the source code
|
||||
in [`helix-term/src/commands.rs`](https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs)
|
||||
at the invocation of `static_commands!` macro and the `TypableCommandList`.
|
||||
* Typable commands: commands that can be executed from command mode (`:`), for
|
||||
example `:write!`. See the [Commands](./commands.html) documentation for a
|
||||
list of available typeable commands.
|
||||
* Macros: sequences of keys that are executed in order. These keybindings
|
||||
start with `@` and then list any number of keys to be executed. For example
|
||||
`@miw` can be used to select the surrounding word. For now, macro keybindings
|
||||
are not allowed in keybinding sequences due to limitations in the way that
|
||||
command sequences are executed.
|
||||
|
@ -29,7 +29,7 @@ unicode-segmentation = "1.12"
|
||||
# For now lets lock the version to avoid rendering glitches
|
||||
# when installing without `--locked`
|
||||
unicode-width = "=0.1.12"
|
||||
unicode-general-category = "0.6"
|
||||
unicode-general-category = "1.0"
|
||||
slotmap.workspace = true
|
||||
tree-sitter.workspace = true
|
||||
once_cell = "1.20"
|
||||
|
@ -2481,15 +2481,17 @@ fn next(&mut self) -> Option<Self::Item> {
|
||||
}
|
||||
}
|
||||
|
||||
// Once a highlighting pattern is found for the current node, skip over
|
||||
// any later highlighting patterns that also match this node. Captures
|
||||
// Use the last capture found for the current node, skipping over any
|
||||
// highlight patterns that also match this node. Captures
|
||||
// for a given node are ordered by pattern index, so these subsequent
|
||||
// captures are guaranteed to be for highlighting, not injections or
|
||||
// local variables.
|
||||
while let Some((next_match, next_capture_index)) = captures.peek() {
|
||||
let next_capture = next_match.captures[*next_capture_index];
|
||||
if next_capture.node == capture.node {
|
||||
captures.next();
|
||||
match_.remove();
|
||||
capture = next_capture;
|
||||
match_ = captures.next().unwrap().0;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
/// Given a slice of text, return the text re-wrapped to fit it
|
||||
/// within the given width.
|
||||
pub fn reflow_hard_wrap(text: &str, text_width: usize) -> SmartString<LazyCompact> {
|
||||
let options = Options::new(text_width).word_splitter(NoHyphenation);
|
||||
let options = Options::new(text_width)
|
||||
.word_splitter(NoHyphenation)
|
||||
.word_separator(textwrap::WordSeparator::AsciiSpace);
|
||||
textwrap::refill(text, options).into()
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ license = "MIT"
|
||||
[dependencies]
|
||||
bitflags = "2.6.0"
|
||||
serde = { version = "1.0.215", features = ["derive"] }
|
||||
serde_json = "1.0.132"
|
||||
serde_json = "1.0.133"
|
||||
serde_repr = "0.1"
|
||||
url = {version = "2.5.3", features = ["serde"]}
|
||||
|
||||
|
@ -15,7 +15,7 @@ homepage.workspace = true
|
||||
dunce = "1.0"
|
||||
etcetera = "0.8"
|
||||
ropey = { version = "1.6.1", default-features = false }
|
||||
which = "6.0"
|
||||
which = "7.0"
|
||||
regex-cursor = "0.1.4"
|
||||
bitflags = "2.6"
|
||||
|
||||
|
@ -56,10 +56,10 @@ ignore = "0.4"
|
||||
pulldown-cmark = { version = "0.12", default-features = false }
|
||||
# file type detection
|
||||
content_inspector = "0.2.4"
|
||||
thiserror = "1.0"
|
||||
thiserror.workspace = true
|
||||
|
||||
# opening URLs
|
||||
open = "5.3.0"
|
||||
open = "5.3.1"
|
||||
url = "2.5.3"
|
||||
|
||||
# config
|
||||
@ -74,7 +74,7 @@ grep-searcher = "0.1.14"
|
||||
|
||||
[target.'cfg(not(windows))'.dependencies] # https://github.com/vorner/signal-hook/issues/100
|
||||
signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] }
|
||||
libc = "0.2.162"
|
||||
libc = "0.2.164"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
crossterm = { version = "0.28", features = ["event-stream", "use-dev-tty", "libc"] }
|
||||
|
@ -2735,7 +2735,9 @@ fn delete_selection_impl(cx: &mut Context, op: Operation, yank: YankAction) {
|
||||
// yank the selection
|
||||
let text = doc.text().slice(..);
|
||||
let values: Vec<String> = selection.fragments(text).map(Cow::into_owned).collect();
|
||||
let reg_name = cx.register.unwrap_or('"');
|
||||
let reg_name = cx
|
||||
.register
|
||||
.unwrap_or_else(|| cx.editor.config.load().default_yank_register);
|
||||
if let Err(err) = cx.editor.registers.write(reg_name, values) {
|
||||
cx.editor.set_error(err.to_string());
|
||||
return;
|
||||
@ -4221,7 +4223,11 @@ fn commit_undo_checkpoint(cx: &mut Context) {
|
||||
// Yank / Paste
|
||||
|
||||
fn yank(cx: &mut Context) {
|
||||
yank_impl(cx.editor, cx.register.unwrap_or('"'));
|
||||
yank_impl(
|
||||
cx.editor,
|
||||
cx.register
|
||||
.unwrap_or(cx.editor.config().default_yank_register),
|
||||
);
|
||||
exit_select_mode(cx);
|
||||
}
|
||||
|
||||
@ -4282,7 +4288,12 @@ fn yank_joined_impl(editor: &mut Editor, separator: &str, register: char) {
|
||||
|
||||
fn yank_joined(cx: &mut Context) {
|
||||
let separator = doc!(cx.editor).line_ending.as_str();
|
||||
yank_joined_impl(cx.editor, separator, cx.register.unwrap_or('"'));
|
||||
yank_joined_impl(
|
||||
cx.editor,
|
||||
separator,
|
||||
cx.register
|
||||
.unwrap_or(cx.editor.config().default_yank_register),
|
||||
);
|
||||
exit_select_mode(cx);
|
||||
}
|
||||
|
||||
@ -4339,6 +4350,10 @@ fn paste_impl(
|
||||
return;
|
||||
}
|
||||
|
||||
if mode == Mode::Insert {
|
||||
doc.append_changes_to_history(view);
|
||||
}
|
||||
|
||||
let repeat = std::iter::repeat(
|
||||
// `values` is asserted to have at least one entry above.
|
||||
values
|
||||
@ -4438,7 +4453,12 @@ fn paste_primary_clipboard_before(cx: &mut Context) {
|
||||
}
|
||||
|
||||
fn replace_with_yanked(cx: &mut Context) {
|
||||
replace_with_yanked_impl(cx.editor, cx.register.unwrap_or('"'), cx.count());
|
||||
replace_with_yanked_impl(
|
||||
cx.editor,
|
||||
cx.register
|
||||
.unwrap_or(cx.editor.config().default_yank_register),
|
||||
cx.count(),
|
||||
);
|
||||
exit_select_mode(cx);
|
||||
}
|
||||
|
||||
@ -4501,7 +4521,8 @@ fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) {
|
||||
fn paste_after(cx: &mut Context) {
|
||||
paste(
|
||||
cx.editor,
|
||||
cx.register.unwrap_or('"'),
|
||||
cx.register
|
||||
.unwrap_or(cx.editor.config().default_yank_register),
|
||||
Paste::After,
|
||||
cx.count(),
|
||||
);
|
||||
@ -4511,7 +4532,8 @@ fn paste_after(cx: &mut Context) {
|
||||
fn paste_before(cx: &mut Context) {
|
||||
paste(
|
||||
cx.editor,
|
||||
cx.register.unwrap_or('"'),
|
||||
cx.register
|
||||
.unwrap_or(cx.editor.config().default_yank_register),
|
||||
Paste::Before,
|
||||
cx.count(),
|
||||
);
|
||||
@ -5365,7 +5387,8 @@ fn insert_register(cx: &mut Context) {
|
||||
cx.register = Some(ch);
|
||||
paste(
|
||||
cx.editor,
|
||||
cx.register.unwrap_or('"'),
|
||||
cx.register
|
||||
.unwrap_or(cx.editor.config().default_yank_register),
|
||||
Paste::Cursor,
|
||||
cx.count(),
|
||||
);
|
||||
|
@ -1074,7 +1074,7 @@ fn show_clipboard_provider(
|
||||
}
|
||||
|
||||
cx.editor
|
||||
.set_status(cx.editor.registers.clipboard_provider_name().to_string());
|
||||
.set_status(cx.editor.registers.clipboard_provider_name());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
use crate::config::{Config, ConfigLoadError};
|
||||
use crossterm::{
|
||||
style::{Color, Print, Stylize},
|
||||
tty::IsTty,
|
||||
};
|
||||
use helix_core::config::{default_lang_config, user_lang_config};
|
||||
use helix_loader::grammar::load_runtime_file;
|
||||
use helix_view::clipboard::get_clipboard_provider;
|
||||
use std::io::Write;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
@ -53,7 +53,6 @@ pub fn general() -> std::io::Result<()> {
|
||||
let lang_file = helix_loader::lang_config_file();
|
||||
let log_file = helix_loader::log_file();
|
||||
let rt_dirs = helix_loader::runtime_dirs();
|
||||
let clipboard_provider = get_clipboard_provider();
|
||||
|
||||
if config_file.exists() {
|
||||
writeln!(stdout, "Config file: {}", config_file.display())?;
|
||||
@ -92,7 +91,6 @@ pub fn general() -> std::io::Result<()> {
|
||||
writeln!(stdout, "{}", msg.yellow())?;
|
||||
}
|
||||
}
|
||||
writeln!(stdout, "Clipboard provider: {}", clipboard_provider.name())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -101,8 +99,19 @@ pub fn clipboard() -> std::io::Result<()> {
|
||||
let stdout = std::io::stdout();
|
||||
let mut stdout = stdout.lock();
|
||||
|
||||
let board = get_clipboard_provider();
|
||||
match board.name().as_ref() {
|
||||
let config = match Config::load_default() {
|
||||
Ok(config) => config,
|
||||
Err(ConfigLoadError::Error(err)) if err.kind() == std::io::ErrorKind::NotFound => {
|
||||
Config::default()
|
||||
}
|
||||
Err(err) => {
|
||||
writeln!(stdout, "{}", "Configuration file malformed".red())?;
|
||||
writeln!(stdout, "{}", err)?;
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
|
||||
match config.editor.clipboard_provider.name().as_ref() {
|
||||
"none" => {
|
||||
writeln!(
|
||||
stdout,
|
||||
|
@ -1,164 +1,408 @@
|
||||
// Implementation reference: https://github.com/neovim/neovim/blob/f2906a4669a2eef6d7bf86a29648793d63c98949/runtime/autoload/provider/clipboard.vim#L68-L152
|
||||
|
||||
use anyhow::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::borrow::Cow;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum ClipboardType {
|
||||
Clipboard,
|
||||
Selection,
|
||||
}
|
||||
|
||||
pub trait ClipboardProvider: std::fmt::Debug {
|
||||
fn name(&self) -> Cow<str>;
|
||||
fn get_contents(&self, clipboard_type: ClipboardType) -> Result<String>;
|
||||
fn set_contents(&mut self, contents: String, clipboard_type: ClipboardType) -> Result<()>;
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
macro_rules! command_provider {
|
||||
(paste => $get_prg:literal $( , $get_arg:literal )* ; copy => $set_prg:literal $( , $set_arg:literal )* ; ) => {{
|
||||
log::debug!(
|
||||
"Using {} to interact with the system clipboard",
|
||||
if $set_prg != $get_prg { format!("{}+{}", $set_prg, $get_prg)} else { $set_prg.to_string() }
|
||||
);
|
||||
Box::new(provider::command::Provider {
|
||||
get_cmd: provider::command::Config {
|
||||
prg: $get_prg,
|
||||
args: &[ $( $get_arg ),* ],
|
||||
},
|
||||
set_cmd: provider::command::Config {
|
||||
prg: $set_prg,
|
||||
args: &[ $( $set_arg ),* ],
|
||||
},
|
||||
get_primary_cmd: None,
|
||||
set_primary_cmd: None,
|
||||
})
|
||||
}};
|
||||
|
||||
(paste => $get_prg:literal $( , $get_arg:literal )* ;
|
||||
copy => $set_prg:literal $( , $set_arg:literal )* ;
|
||||
primary_paste => $pr_get_prg:literal $( , $pr_get_arg:literal )* ;
|
||||
primary_copy => $pr_set_prg:literal $( , $pr_set_arg:literal )* ;
|
||||
) => {{
|
||||
log::debug!(
|
||||
"Using {} to interact with the system and selection (primary) clipboard",
|
||||
if $set_prg != $get_prg { format!("{}+{}", $set_prg, $get_prg)} else { $set_prg.to_string() }
|
||||
);
|
||||
Box::new(provider::command::Provider {
|
||||
get_cmd: provider::command::Config {
|
||||
prg: $get_prg,
|
||||
args: &[ $( $get_arg ),* ],
|
||||
},
|
||||
set_cmd: provider::command::Config {
|
||||
prg: $set_prg,
|
||||
args: &[ $( $set_arg ),* ],
|
||||
},
|
||||
get_primary_cmd: Some(provider::command::Config {
|
||||
prg: $pr_get_prg,
|
||||
args: &[ $( $pr_get_arg ),* ],
|
||||
}),
|
||||
set_primary_cmd: Some(provider::command::Config {
|
||||
prg: $pr_set_prg,
|
||||
args: &[ $( $pr_set_arg ),* ],
|
||||
}),
|
||||
})
|
||||
}};
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ClipboardError {
|
||||
#[error(transparent)]
|
||||
IoError(#[from] std::io::Error),
|
||||
#[error("could not convert terminal output to UTF-8: {0}")]
|
||||
FromUtf8Error(#[from] std::string::FromUtf8Error),
|
||||
#[cfg(windows)]
|
||||
pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
|
||||
Box::<provider::WindowsProvider>::default()
|
||||
#[error("Windows API error: {0}")]
|
||||
WinAPI(#[from] clipboard_win::ErrorCode),
|
||||
#[error("clipboard provider command failed")]
|
||||
CommandFailed,
|
||||
#[error("failed to write to clipboard provider's stdin")]
|
||||
StdinWriteFailed,
|
||||
#[error("clipboard provider did not return any contents")]
|
||||
MissingStdout,
|
||||
#[error("This clipboard provider does not support reading")]
|
||||
ReadingNotSupported,
|
||||
}
|
||||
|
||||
type Result<T> = std::result::Result<T, ClipboardError>;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub use external::ClipboardProvider;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub use noop::ClipboardProvider;
|
||||
|
||||
// Clipboard not supported for wasm
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
mod noop {
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ClipboardProvider {}
|
||||
|
||||
impl ClipboardProvider {
|
||||
pub fn detect() -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
pub fn name(&self) -> Cow<str> {
|
||||
"none".into()
|
||||
}
|
||||
|
||||
pub fn get_contents(&self, _clipboard_type: ClipboardType) -> Result<String> {
|
||||
Err(ClipboardError::ReadingNotSupported)
|
||||
}
|
||||
|
||||
pub fn set_contents(&self, _content: &str, _clipboard_type: ClipboardType) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
mod external {
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct Command {
|
||||
command: Cow<'static, str>,
|
||||
#[serde(default)]
|
||||
args: Cow<'static, [Cow<'static, str>]>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct CommandProvider {
|
||||
yank: Command,
|
||||
paste: Command,
|
||||
yank_primary: Option<Command>,
|
||||
paste_primary: Option<Command>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ClipboardProvider {
|
||||
Pasteboard,
|
||||
Wayland,
|
||||
XClip,
|
||||
XSel,
|
||||
Win32Yank,
|
||||
Tmux,
|
||||
#[cfg(windows)]
|
||||
Windows,
|
||||
Termux,
|
||||
#[cfg(feature = "term")]
|
||||
Termcode,
|
||||
Custom(CommandProvider),
|
||||
None,
|
||||
}
|
||||
|
||||
impl Default for ClipboardProvider {
|
||||
#[cfg(windows)]
|
||||
fn default() -> Self {
|
||||
use helix_stdx::env::binary_exists;
|
||||
|
||||
if binary_exists("win32yank.exe") {
|
||||
Self::Win32Yank
|
||||
} else {
|
||||
Self::Windows
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
|
||||
fn default() -> Self {
|
||||
use helix_stdx::env::{binary_exists, env_var_is_set};
|
||||
|
||||
if env_var_is_set("TMUX") && binary_exists("tmux") {
|
||||
command_provider! {
|
||||
paste => "tmux", "save-buffer", "-";
|
||||
copy => "tmux", "load-buffer", "-w", "-";
|
||||
}
|
||||
Self::Tmux
|
||||
} else if binary_exists("pbcopy") && binary_exists("pbpaste") {
|
||||
command_provider! {
|
||||
paste => "pbpaste";
|
||||
copy => "pbcopy";
|
||||
}
|
||||
Self::Pasteboard
|
||||
} else if cfg!(feature = "term") {
|
||||
Self::Termcode
|
||||
} else {
|
||||
Box::new(provider::FallbackProvider::new())
|
||||
Self::None
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
|
||||
// TODO:
|
||||
Box::new(provider::FallbackProvider::new())
|
||||
}
|
||||
|
||||
#[cfg(not(any(windows, target_arch = "wasm32", target_os = "macos")))]
|
||||
pub fn get_clipboard_provider() -> Box<dyn ClipboardProvider> {
|
||||
#[cfg(not(any(windows, target_os = "macos")))]
|
||||
fn default() -> Self {
|
||||
use helix_stdx::env::{binary_exists, env_var_is_set};
|
||||
use provider::command::is_exit_success;
|
||||
// TODO: support for user-defined provider, probably when we have plugin support by setting a
|
||||
// variable?
|
||||
|
||||
if env_var_is_set("WAYLAND_DISPLAY") && binary_exists("wl-copy") && binary_exists("wl-paste") {
|
||||
command_provider! {
|
||||
paste => "wl-paste", "--no-newline";
|
||||
copy => "wl-copy", "--type", "text/plain";
|
||||
primary_paste => "wl-paste", "-p", "--no-newline";
|
||||
primary_copy => "wl-copy", "-p", "--type", "text/plain";
|
||||
fn is_exit_success(program: &str, args: &[&str]) -> bool {
|
||||
std::process::Command::new(program)
|
||||
.args(args)
|
||||
.output()
|
||||
.ok()
|
||||
.and_then(|out| out.status.success().then_some(()))
|
||||
.is_some()
|
||||
}
|
||||
|
||||
if env_var_is_set("WAYLAND_DISPLAY")
|
||||
&& binary_exists("wl-copy")
|
||||
&& binary_exists("wl-paste")
|
||||
{
|
||||
Self::Wayland
|
||||
} else if env_var_is_set("DISPLAY") && binary_exists("xclip") {
|
||||
command_provider! {
|
||||
paste => "xclip", "-o", "-selection", "clipboard";
|
||||
copy => "xclip", "-i", "-selection", "clipboard";
|
||||
primary_paste => "xclip", "-o";
|
||||
primary_copy => "xclip", "-i";
|
||||
}
|
||||
Self::XClip
|
||||
} else if env_var_is_set("DISPLAY")
|
||||
&& binary_exists("xsel")
|
||||
// FIXME: check performance of is_exit_success
|
||||
&& is_exit_success("xsel", &["-o", "-b"])
|
||||
{
|
||||
// FIXME: check performance of is_exit_success
|
||||
command_provider! {
|
||||
paste => "xsel", "-o", "-b";
|
||||
copy => "xsel", "-i", "-b";
|
||||
primary_paste => "xsel", "-o";
|
||||
primary_copy => "xsel", "-i";
|
||||
}
|
||||
} else if binary_exists("win32yank.exe") {
|
||||
command_provider! {
|
||||
paste => "win32yank.exe", "-o", "--lf";
|
||||
copy => "win32yank.exe", "-i", "--crlf";
|
||||
}
|
||||
} else if binary_exists("termux-clipboard-set") && binary_exists("termux-clipboard-get") {
|
||||
command_provider! {
|
||||
paste => "termux-clipboard-get";
|
||||
copy => "termux-clipboard-set";
|
||||
}
|
||||
Self::XSel
|
||||
} else if binary_exists("termux-clipboard-set") && binary_exists("termux-clipboard-get")
|
||||
{
|
||||
Self::Termux
|
||||
} else if env_var_is_set("TMUX") && binary_exists("tmux") {
|
||||
command_provider! {
|
||||
paste => "tmux", "save-buffer", "-";
|
||||
copy => "tmux", "load-buffer", "-w", "-";
|
||||
}
|
||||
Self::Tmux
|
||||
} else if binary_exists("win32yank.exe") {
|
||||
Self::Win32Yank
|
||||
} else if cfg!(feature = "term") {
|
||||
Self::Termcode
|
||||
} else {
|
||||
Box::new(provider::FallbackProvider::new())
|
||||
Self::None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
pub mod provider {
|
||||
use super::{ClipboardProvider, ClipboardType};
|
||||
use anyhow::Result;
|
||||
use std::borrow::Cow;
|
||||
impl ClipboardProvider {
|
||||
pub fn name(&self) -> Cow<'_, str> {
|
||||
fn builtin_name<'a>(
|
||||
name: &'static str,
|
||||
provider: &'static CommandProvider,
|
||||
) -> Cow<'a, str> {
|
||||
if provider.yank.command != provider.paste.command {
|
||||
Cow::Owned(format!(
|
||||
"{} ({}+{})",
|
||||
name, provider.yank.command, provider.paste.command
|
||||
))
|
||||
} else {
|
||||
Cow::Owned(format!("{} ({})", name, provider.yank.command))
|
||||
}
|
||||
}
|
||||
|
||||
match self {
|
||||
// These names should match the config option names from Serde
|
||||
Self::Pasteboard => builtin_name("pasteboard", &PASTEBOARD),
|
||||
Self::Wayland => builtin_name("wayland", &WL_CLIPBOARD),
|
||||
Self::XClip => builtin_name("x-clip", &XCLIP),
|
||||
Self::XSel => builtin_name("x-sel", &XSEL),
|
||||
Self::Win32Yank => builtin_name("win-32-yank", &WIN32),
|
||||
Self::Tmux => builtin_name("tmux", &TMUX),
|
||||
Self::Termux => builtin_name("termux", &TERMUX),
|
||||
#[cfg(windows)]
|
||||
Self::Windows => "windows".into(),
|
||||
#[cfg(feature = "term")]
|
||||
Self::Termcode => "termcode".into(),
|
||||
Self::Custom(command_provider) => Cow::Owned(format!(
|
||||
"custom ({}+{})",
|
||||
command_provider.yank.command, command_provider.paste.command
|
||||
)),
|
||||
Self::None => "none".into(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_contents(&self, clipboard_type: &ClipboardType) -> Result<String> {
|
||||
fn yank_from_builtin(
|
||||
provider: CommandProvider,
|
||||
clipboard_type: &ClipboardType,
|
||||
) -> Result<String> {
|
||||
match clipboard_type {
|
||||
ClipboardType::Clipboard => execute_command(&provider.yank, None, true)?
|
||||
.ok_or(ClipboardError::MissingStdout),
|
||||
ClipboardType::Selection => {
|
||||
if let Some(cmd) = provider.yank_primary.as_ref() {
|
||||
return execute_command(cmd, None, true)?
|
||||
.ok_or(ClipboardError::MissingStdout);
|
||||
}
|
||||
|
||||
Ok(String::new())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
match self {
|
||||
Self::Pasteboard => yank_from_builtin(PASTEBOARD, clipboard_type),
|
||||
Self::Wayland => yank_from_builtin(WL_CLIPBOARD, clipboard_type),
|
||||
Self::XClip => yank_from_builtin(XCLIP, clipboard_type),
|
||||
Self::XSel => yank_from_builtin(XSEL, clipboard_type),
|
||||
Self::Win32Yank => yank_from_builtin(WIN32, clipboard_type),
|
||||
Self::Tmux => yank_from_builtin(TMUX, clipboard_type),
|
||||
Self::Termux => yank_from_builtin(TERMUX, clipboard_type),
|
||||
#[cfg(target_os = "windows")]
|
||||
Self::Windows => match clipboard_type {
|
||||
ClipboardType::Clipboard => {
|
||||
let contents =
|
||||
clipboard_win::get_clipboard(clipboard_win::formats::Unicode)?;
|
||||
Ok(contents)
|
||||
}
|
||||
ClipboardType::Selection => Ok(String::new()),
|
||||
},
|
||||
#[cfg(feature = "term")]
|
||||
Self::Termcode => Err(ClipboardError::ReadingNotSupported),
|
||||
Self::Custom(command_provider) => {
|
||||
execute_command(&command_provider.yank, None, true)?
|
||||
.ok_or(ClipboardError::MissingStdout)
|
||||
}
|
||||
Self::None => Err(ClipboardError::ReadingNotSupported),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_contents(&self, content: &str, clipboard_type: ClipboardType) -> Result<()> {
|
||||
fn paste_to_builtin(
|
||||
provider: CommandProvider,
|
||||
content: &str,
|
||||
clipboard_type: ClipboardType,
|
||||
) -> Result<()> {
|
||||
let cmd = match clipboard_type {
|
||||
ClipboardType::Clipboard => &provider.paste,
|
||||
ClipboardType::Selection => {
|
||||
if let Some(cmd) = provider.paste_primary.as_ref() {
|
||||
cmd
|
||||
} else {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
execute_command(cmd, Some(content), false).map(|_| ())
|
||||
}
|
||||
|
||||
match self {
|
||||
Self::Pasteboard => paste_to_builtin(PASTEBOARD, content, clipboard_type),
|
||||
Self::Wayland => paste_to_builtin(WL_CLIPBOARD, content, clipboard_type),
|
||||
Self::XClip => paste_to_builtin(XCLIP, content, clipboard_type),
|
||||
Self::XSel => paste_to_builtin(XSEL, content, clipboard_type),
|
||||
Self::Win32Yank => paste_to_builtin(WIN32, content, clipboard_type),
|
||||
Self::Tmux => paste_to_builtin(TMUX, content, clipboard_type),
|
||||
Self::Termux => paste_to_builtin(TERMUX, content, clipboard_type),
|
||||
#[cfg(target_os = "windows")]
|
||||
Self::Windows => match clipboard_type {
|
||||
ClipboardType::Clipboard => {
|
||||
clipboard_win::set_clipboard(clipboard_win::formats::Unicode, content)?;
|
||||
Ok(())
|
||||
}
|
||||
ClipboardType::Selection => Ok(()),
|
||||
},
|
||||
#[cfg(feature = "term")]
|
||||
Self::Termcode => {
|
||||
crossterm::queue!(
|
||||
std::io::stdout(),
|
||||
osc52::SetClipboardCommand::new(content, clipboard_type)
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
Self::Custom(command_provider) => match clipboard_type {
|
||||
ClipboardType::Clipboard => {
|
||||
execute_command(&command_provider.paste, Some(content), false).map(|_| ())
|
||||
}
|
||||
ClipboardType::Selection => {
|
||||
if let Some(cmd) = &command_provider.paste_primary {
|
||||
execute_command(cmd, Some(content), false).map(|_| ())
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
},
|
||||
Self::None => Ok(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! command_provider {
|
||||
($name:ident,
|
||||
yank => $yank_cmd:literal $( , $yank_arg:literal )* ;
|
||||
paste => $paste_cmd:literal $( , $paste_arg:literal )* ; ) => {
|
||||
const $name: CommandProvider = CommandProvider {
|
||||
yank: Command {
|
||||
command: Cow::Borrowed($yank_cmd),
|
||||
args: Cow::Borrowed(&[ $( Cow::Borrowed($yank_arg) ),* ])
|
||||
},
|
||||
paste: Command {
|
||||
command: Cow::Borrowed($paste_cmd),
|
||||
args: Cow::Borrowed(&[ $( Cow::Borrowed($paste_arg) ),* ])
|
||||
},
|
||||
yank_primary: None,
|
||||
paste_primary: None,
|
||||
};
|
||||
};
|
||||
($name:ident,
|
||||
yank => $yank_cmd:literal $( , $yank_arg:literal )* ;
|
||||
paste => $paste_cmd:literal $( , $paste_arg:literal )* ;
|
||||
yank_primary => $yank_primary_cmd:literal $( , $yank_primary_arg:literal )* ;
|
||||
paste_primary => $paste_primary_cmd:literal $( , $paste_primary_arg:literal )* ; ) => {
|
||||
const $name: CommandProvider = CommandProvider {
|
||||
yank: Command {
|
||||
command: Cow::Borrowed($yank_cmd),
|
||||
args: Cow::Borrowed(&[ $( Cow::Borrowed($yank_arg) ),* ])
|
||||
},
|
||||
paste: Command {
|
||||
command: Cow::Borrowed($paste_cmd),
|
||||
args: Cow::Borrowed(&[ $( Cow::Borrowed($paste_arg) ),* ])
|
||||
},
|
||||
yank_primary: Some(Command {
|
||||
command: Cow::Borrowed($yank_primary_cmd),
|
||||
args: Cow::Borrowed(&[ $( Cow::Borrowed($yank_primary_arg) ),* ])
|
||||
}),
|
||||
paste_primary: Some(Command {
|
||||
command: Cow::Borrowed($paste_primary_cmd),
|
||||
args: Cow::Borrowed(&[ $( Cow::Borrowed($paste_primary_arg) ),* ])
|
||||
}),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
command_provider! {
|
||||
TMUX,
|
||||
yank => "tmux", "save-buffer", "-";
|
||||
paste => "tmux", "load-buffer", "-w", "-";
|
||||
}
|
||||
command_provider! {
|
||||
PASTEBOARD,
|
||||
yank => "pbpaste";
|
||||
paste => "pbcopy";
|
||||
}
|
||||
command_provider! {
|
||||
WL_CLIPBOARD,
|
||||
yank => "wl-paste", "--no-newline";
|
||||
paste => "wl-copy", "--type", "text/plain";
|
||||
yank_primary => "wl-paste", "-p", "--no-newline";
|
||||
paste_primary => "wl-copy", "-p", "--type", "text/plain";
|
||||
}
|
||||
command_provider! {
|
||||
XCLIP,
|
||||
yank => "xclip", "-o", "-selection", "clipboard";
|
||||
paste => "xclip", "-i", "-selection", "clipboard";
|
||||
yank_primary => "xclip", "-o";
|
||||
paste_primary => "xclip", "-i";
|
||||
}
|
||||
command_provider! {
|
||||
XSEL,
|
||||
yank => "xsel", "-o", "-b";
|
||||
paste => "xsel", "-i", "-b";
|
||||
yank_primary => "xsel", "-o";
|
||||
paste_primary => "xsel", "-i";
|
||||
}
|
||||
command_provider! {
|
||||
WIN32,
|
||||
yank => "win32yank.exe", "-o", "--lf";
|
||||
paste => "win32yank.exe", "-i", "--crlf";
|
||||
}
|
||||
command_provider! {
|
||||
TERMUX,
|
||||
yank => "termux-clipboard-get";
|
||||
paste => "termux-clipboard-set";
|
||||
}
|
||||
|
||||
#[cfg(feature = "term")]
|
||||
mod osc52 {
|
||||
use {super::ClipboardType, crate::base64};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SetClipboardCommand {
|
||||
encoded_content: String,
|
||||
clipboard_type: ClipboardType,
|
||||
@ -182,115 +426,39 @@ fn write_ansi(&self, f: &mut impl std::fmt::Write) -> std::fmt::Result {
|
||||
// Send an OSC 52 set command: https://terminalguide.namepad.de/seq/osc-52/
|
||||
write!(f, "\x1b]52;{};{}\x1b\\", kind, &self.encoded_content)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FallbackProvider {
|
||||
buf: String,
|
||||
primary_buf: String,
|
||||
}
|
||||
|
||||
impl FallbackProvider {
|
||||
pub fn new() -> Self {
|
||||
#[cfg(feature = "term")]
|
||||
log::debug!(
|
||||
"No native clipboard provider found. Yanking by OSC 52 and pasting will be internal to Helix"
|
||||
);
|
||||
#[cfg(not(feature = "term"))]
|
||||
log::warn!(
|
||||
"No native clipboard provider found! Yanking and pasting will be internal to Helix"
|
||||
);
|
||||
Self {
|
||||
buf: String::new(),
|
||||
primary_buf: String::new(),
|
||||
#[cfg(windows)]
|
||||
fn execute_winapi(&self) -> std::result::Result<(), std::io::Error> {
|
||||
Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
"OSC clipboard codes not supported by winapi.",
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for FallbackProvider {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl ClipboardProvider for FallbackProvider {
|
||||
#[cfg(feature = "term")]
|
||||
fn name(&self) -> Cow<str> {
|
||||
Cow::Borrowed("termcode")
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "term"))]
|
||||
fn name(&self) -> Cow<str> {
|
||||
Cow::Borrowed("none")
|
||||
}
|
||||
|
||||
fn get_contents(&self, clipboard_type: ClipboardType) -> Result<String> {
|
||||
// This is the same noop if term is enabled or not.
|
||||
// We don't use the get side of OSC 52 as it isn't often enabled, it's a security hole,
|
||||
// and it would require this to be async to listen for the response
|
||||
let value = match clipboard_type {
|
||||
ClipboardType::Clipboard => self.buf.clone(),
|
||||
ClipboardType::Selection => self.primary_buf.clone(),
|
||||
};
|
||||
|
||||
Ok(value)
|
||||
}
|
||||
|
||||
fn set_contents(&mut self, content: String, clipboard_type: ClipboardType) -> Result<()> {
|
||||
#[cfg(feature = "term")]
|
||||
crossterm::execute!(
|
||||
std::io::stdout(),
|
||||
osc52::SetClipboardCommand::new(&content, clipboard_type)
|
||||
)?;
|
||||
// Set our internal variables to use in get_content regardless of using OSC 52
|
||||
match clipboard_type {
|
||||
ClipboardType::Clipboard => self.buf = content,
|
||||
ClipboardType::Selection => self.primary_buf = content,
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub mod command {
|
||||
use super::*;
|
||||
use anyhow::{bail, Context as _};
|
||||
|
||||
#[cfg(not(any(windows, target_os = "macos")))]
|
||||
pub fn is_exit_success(program: &str, args: &[&str]) -> bool {
|
||||
std::process::Command::new(program)
|
||||
.args(args)
|
||||
.output()
|
||||
.ok()
|
||||
.and_then(|out| out.status.success().then_some(()))
|
||||
.is_some()
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Config {
|
||||
pub prg: &'static str,
|
||||
pub args: &'static [&'static str],
|
||||
}
|
||||
|
||||
impl Config {
|
||||
fn execute(&self, input: Option<&str>, pipe_output: bool) -> Result<Option<String>> {
|
||||
fn execute_command(
|
||||
cmd: &Command,
|
||||
input: Option<&str>,
|
||||
pipe_output: bool,
|
||||
) -> Result<Option<String>> {
|
||||
use std::io::Write;
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
let stdin = input.map(|_| Stdio::piped()).unwrap_or_else(Stdio::null);
|
||||
let stdout = pipe_output.then(Stdio::piped).unwrap_or_else(Stdio::null);
|
||||
|
||||
let mut command: Command = Command::new(self.prg);
|
||||
let mut command: Command = Command::new(cmd.command.as_ref());
|
||||
|
||||
#[allow(unused_mut)]
|
||||
let mut command_mut: &mut Command = command
|
||||
.args(self.args)
|
||||
.args(cmd.args.iter().map(AsRef::as_ref))
|
||||
.stdin(stdin)
|
||||
.stdout(stdout)
|
||||
.stderr(Stdio::null());
|
||||
|
||||
// Fix for https://github.com/helix-editor/helix/issues/5424
|
||||
if cfg!(unix) {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::process::CommandExt;
|
||||
|
||||
unsafe {
|
||||
@ -304,17 +472,22 @@ fn execute(&self, input: Option<&str>, pipe_output: bool) -> Result<Option<Strin
|
||||
let mut child = command_mut.spawn()?;
|
||||
|
||||
if let Some(input) = input {
|
||||
let mut stdin = child.stdin.take().context("stdin is missing")?;
|
||||
let mut stdin = child.stdin.take().ok_or(ClipboardError::StdinWriteFailed)?;
|
||||
stdin
|
||||
.write_all(input.as_bytes())
|
||||
.context("couldn't write in stdin")?;
|
||||
.map_err(|_| ClipboardError::StdinWriteFailed)?;
|
||||
}
|
||||
|
||||
// TODO: add timer?
|
||||
let output = child.wait_with_output()?;
|
||||
|
||||
if !output.status.success() {
|
||||
bail!("clipboard provider {} failed", self.prg);
|
||||
log::error!(
|
||||
"clipboard provider {} failed with stderr: \"{}\"",
|
||||
cmd.command,
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
return Err(ClipboardError::CommandFailed);
|
||||
}
|
||||
|
||||
if pipe_output {
|
||||
@ -324,90 +497,3 @@ fn execute(&self, input: Option<&str>, pipe_output: bool) -> Result<Option<Strin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Provider {
|
||||
pub get_cmd: Config,
|
||||
pub set_cmd: Config,
|
||||
pub get_primary_cmd: Option<Config>,
|
||||
pub set_primary_cmd: Option<Config>,
|
||||
}
|
||||
|
||||
impl ClipboardProvider for Provider {
|
||||
fn name(&self) -> Cow<str> {
|
||||
if self.get_cmd.prg != self.set_cmd.prg {
|
||||
Cow::Owned(format!("{}+{}", self.get_cmd.prg, self.set_cmd.prg))
|
||||
} else {
|
||||
Cow::Borrowed(self.get_cmd.prg)
|
||||
}
|
||||
}
|
||||
|
||||
fn get_contents(&self, clipboard_type: ClipboardType) -> Result<String> {
|
||||
match clipboard_type {
|
||||
ClipboardType::Clipboard => Ok(self
|
||||
.get_cmd
|
||||
.execute(None, true)?
|
||||
.context("output is missing")?),
|
||||
ClipboardType::Selection => {
|
||||
if let Some(cmd) = &self.get_primary_cmd {
|
||||
return cmd.execute(None, true)?.context("output is missing");
|
||||
}
|
||||
|
||||
Ok(String::new())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn set_contents(&mut self, value: String, clipboard_type: ClipboardType) -> Result<()> {
|
||||
let cmd = match clipboard_type {
|
||||
ClipboardType::Clipboard => &self.set_cmd,
|
||||
ClipboardType::Selection => {
|
||||
if let Some(cmd) = &self.set_primary_cmd {
|
||||
cmd
|
||||
} else {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
};
|
||||
cmd.execute(Some(&value), false).map(|_| ())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
mod provider {
|
||||
use super::{ClipboardProvider, ClipboardType};
|
||||
use anyhow::Result;
|
||||
use std::borrow::Cow;
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
pub struct WindowsProvider;
|
||||
|
||||
impl ClipboardProvider for WindowsProvider {
|
||||
fn name(&self) -> Cow<str> {
|
||||
log::debug!("Using clipboard-win to interact with the system clipboard");
|
||||
Cow::Borrowed("clipboard-win")
|
||||
}
|
||||
|
||||
fn get_contents(&self, clipboard_type: ClipboardType) -> Result<String> {
|
||||
match clipboard_type {
|
||||
ClipboardType::Clipboard => {
|
||||
let contents = clipboard_win::get_clipboard(clipboard_win::formats::Unicode)?;
|
||||
Ok(contents)
|
||||
}
|
||||
ClipboardType::Selection => Ok(String::new()),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_contents(&mut self, contents: String, clipboard_type: ClipboardType) -> Result<()> {
|
||||
match clipboard_type {
|
||||
ClipboardType::Clipboard => {
|
||||
clipboard_win::set_clipboard(clipboard_win::formats::Unicode, contents)?;
|
||||
}
|
||||
ClipboardType::Selection => {}
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
use crate::{
|
||||
annotations::diagnostics::{DiagnosticFilter, InlineDiagnosticsConfig},
|
||||
clipboard::ClipboardProvider,
|
||||
document::{
|
||||
DocumentOpenError, DocumentSavedEventFuture, DocumentSavedEventResult, Mode, SavePoint,
|
||||
},
|
||||
@ -269,6 +270,8 @@ pub struct Config {
|
||||
pub auto_completion: bool,
|
||||
/// Automatic formatting on save. Defaults to true.
|
||||
pub auto_format: bool,
|
||||
/// Default register used for yank/paste. Defaults to '"'
|
||||
pub default_yank_register: char,
|
||||
/// Automatic save on focus lost and/or after delay.
|
||||
/// Time delay in milliseconds since last edit after which auto save timer triggers.
|
||||
/// Time delay defaults to false with 3000ms delay. Focus lost defaults to false.
|
||||
@ -345,6 +348,8 @@ pub struct Config {
|
||||
/// Display diagnostic below the line they occur.
|
||||
pub inline_diagnostics: InlineDiagnosticsConfig,
|
||||
pub end_of_line_diagnostics: DiagnosticFilter,
|
||||
// Set to override the default clipboard provider
|
||||
pub clipboard_provider: ClipboardProvider,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq, PartialOrd, Ord)]
|
||||
@ -948,6 +953,7 @@ fn default() -> Self {
|
||||
auto_pairs: AutoPairConfig::default(),
|
||||
auto_completion: true,
|
||||
auto_format: true,
|
||||
default_yank_register: '"',
|
||||
auto_save: AutoSave::default(),
|
||||
idle_timeout: Duration::from_millis(250),
|
||||
completion_timeout: Duration::from_millis(250),
|
||||
@ -982,6 +988,7 @@ fn default() -> Self {
|
||||
jump_label_alphabet: ('a'..='z').collect(),
|
||||
inline_diagnostics: InlineDiagnosticsConfig::default(),
|
||||
end_of_line_diagnostics: DiagnosticFilter::Disable,
|
||||
clipboard_provider: ClipboardProvider::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1183,7 +1190,10 @@ pub fn new(
|
||||
theme_loader,
|
||||
last_theme: None,
|
||||
last_selection: None,
|
||||
registers: Registers::default(),
|
||||
registers: Registers::new(Box::new(arc_swap::access::Map::new(
|
||||
Arc::clone(&config),
|
||||
|config: &Config| &config.clipboard_provider,
|
||||
))),
|
||||
status_msg: None,
|
||||
autoinfo: None,
|
||||
idle_timer: Box::pin(sleep(conf.idle_timeout)),
|
||||
|
@ -1,10 +1,11 @@
|
||||
use std::{borrow::Cow, collections::HashMap, iter};
|
||||
|
||||
use anyhow::Result;
|
||||
use arc_swap::access::DynAccess;
|
||||
use helix_core::NATIVE_LINE_ENDING;
|
||||
|
||||
use crate::{
|
||||
clipboard::{get_clipboard_provider, ClipboardProvider, ClipboardType},
|
||||
clipboard::{ClipboardProvider, ClipboardType},
|
||||
Editor,
|
||||
};
|
||||
|
||||
@ -20,28 +21,25 @@
|
||||
/// * Document path (`%`): filename of the current buffer
|
||||
/// * System clipboard (`*`)
|
||||
/// * Primary clipboard (`+`)
|
||||
#[derive(Debug)]
|
||||
pub struct Registers {
|
||||
/// The mapping of register to values.
|
||||
/// Values are stored in reverse order when inserted with `Registers::write`.
|
||||
/// The order is reversed again in `Registers::read`. This allows us to
|
||||
/// efficiently prepend new values in `Registers::push`.
|
||||
inner: HashMap<char, Vec<String>>,
|
||||
clipboard_provider: Box<dyn ClipboardProvider>,
|
||||
clipboard_provider: Box<dyn DynAccess<ClipboardProvider>>,
|
||||
pub last_search_register: char,
|
||||
}
|
||||
|
||||
impl Default for Registers {
|
||||
fn default() -> Self {
|
||||
impl Registers {
|
||||
pub fn new(clipboard_provider: Box<dyn DynAccess<ClipboardProvider>>) -> Self {
|
||||
Self {
|
||||
inner: Default::default(),
|
||||
clipboard_provider: get_clipboard_provider(),
|
||||
clipboard_provider,
|
||||
last_search_register: '/',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Registers {
|
||||
pub fn read<'a>(&'a self, name: char, editor: &'a Editor) -> Option<RegisterValues<'a>> {
|
||||
match name {
|
||||
'_' => Some(RegisterValues::new(iter::empty())),
|
||||
@ -64,7 +62,7 @@ pub fn read<'a>(&'a self, name: char, editor: &'a Editor) -> Option<RegisterValu
|
||||
Some(RegisterValues::new(iter::once(path)))
|
||||
}
|
||||
'*' | '+' => Some(read_from_clipboard(
|
||||
self.clipboard_provider.as_ref(),
|
||||
&self.clipboard_provider.load(),
|
||||
self.inner.get(&name),
|
||||
match name {
|
||||
'+' => ClipboardType::Clipboard,
|
||||
@ -84,8 +82,8 @@ pub fn write(&mut self, name: char, mut values: Vec<String>) -> Result<()> {
|
||||
'_' => Ok(()),
|
||||
'#' | '.' | '%' => Err(anyhow::anyhow!("Register {name} does not support writing")),
|
||||
'*' | '+' => {
|
||||
self.clipboard_provider.set_contents(
|
||||
values.join(NATIVE_LINE_ENDING.as_str()),
|
||||
self.clipboard_provider.load().set_contents(
|
||||
&values.join(NATIVE_LINE_ENDING.as_str()),
|
||||
match name {
|
||||
'+' => ClipboardType::Clipboard,
|
||||
'*' => ClipboardType::Selection,
|
||||
@ -114,7 +112,10 @@ pub fn push(&mut self, name: char, mut value: String) -> Result<()> {
|
||||
'*' => ClipboardType::Selection,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let contents = self.clipboard_provider.get_contents(clipboard_type)?;
|
||||
let contents = self
|
||||
.clipboard_provider
|
||||
.load()
|
||||
.get_contents(&clipboard_type)?;
|
||||
let saved_values = self.inner.entry(name).or_default();
|
||||
|
||||
if !contents_are_saved(saved_values, &contents) {
|
||||
@ -127,7 +128,8 @@ pub fn push(&mut self, name: char, mut value: String) -> Result<()> {
|
||||
}
|
||||
value.push_str(&contents);
|
||||
self.clipboard_provider
|
||||
.set_contents(value, clipboard_type)?;
|
||||
.load()
|
||||
.set_contents(&value, clipboard_type)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -198,7 +200,8 @@ pub fn remove(&mut self, name: char) -> bool {
|
||||
fn clear_clipboard(&mut self, clipboard_type: ClipboardType) {
|
||||
if let Err(err) = self
|
||||
.clipboard_provider
|
||||
.set_contents("".into(), clipboard_type)
|
||||
.load()
|
||||
.set_contents("", clipboard_type)
|
||||
{
|
||||
log::error!(
|
||||
"Failed to clear {} clipboard: {err}",
|
||||
@ -210,17 +213,17 @@ fn clear_clipboard(&mut self, clipboard_type: ClipboardType) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clipboard_provider_name(&self) -> Cow<str> {
|
||||
self.clipboard_provider.name()
|
||||
pub fn clipboard_provider_name(&self) -> String {
|
||||
self.clipboard_provider.load().name().into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
fn read_from_clipboard<'a>(
|
||||
provider: &dyn ClipboardProvider,
|
||||
provider: &ClipboardProvider,
|
||||
saved_values: Option<&'a Vec<String>>,
|
||||
clipboard_type: ClipboardType,
|
||||
) -> RegisterValues<'a> {
|
||||
match provider.get_contents(clipboard_type) {
|
||||
match provider.get_contents(&clipboard_type) {
|
||||
Ok(contents) => {
|
||||
// If we're pasting the same values that we just yanked, re-use
|
||||
// the saved values. This allows pasting multiple selections
|
||||
|
114
languages.toml
114
languages.toml
@ -44,6 +44,7 @@ gleam = { command = "gleam", args = ["lsp"] }
|
||||
glsl_analyzer = { command = "glsl_analyzer" }
|
||||
graphql-language-service = { command = "graphql-lsp", args = ["server", "-m", "stream"] }
|
||||
haskell-language-server = { command = "haskell-language-server-wrapper", args = ["--lsp"] }
|
||||
hyprls = { command = "hyprls" }
|
||||
idris2-lsp = { command = "idris2-lsp" }
|
||||
intelephense = { command = "intelephense", args = ["--stdio"] }
|
||||
jdtls = { command = "jdtls" }
|
||||
@ -83,6 +84,7 @@ pyright = { command = "pyright-langserver", args = ["--stdio"], config = {} }
|
||||
basedpyright = { command = "basedpyright-langserver", args = ["--stdio"], config = {} }
|
||||
pylyzer = { command = "pylyzer", args = ["--server"] }
|
||||
qmlls = { command = "qmlls" }
|
||||
quint-language-server = { command = "quint-language-server", args = ["--stdio"] }
|
||||
r = { command = "R", args = ["--no-echo", "-e", "languageserver::run()"] }
|
||||
racket = { command = "racket", args = ["-l", "racket-langserver"] }
|
||||
regols = { command = "regols" }
|
||||
@ -94,6 +96,7 @@ slint-lsp = { command = "slint-lsp", args = [] }
|
||||
solargraph = { command = "solargraph", args = ["stdio"] }
|
||||
solc = { command = "solc", args = ["--lsp"] }
|
||||
sourcekit-lsp = { command = "sourcekit-lsp" }
|
||||
spade-language-server = {command = "spade-language-server"}
|
||||
svlangserver = { command = "svlangserver", args = [] }
|
||||
swipl = { command = "swipl", args = [ "-g", "use_module(library(lsp_server))", "-g", "lsp_server:main", "-t", "halt", "--", "stdio" ] }
|
||||
superhtml = { command = "superhtml", args = ["lsp"]}
|
||||
@ -344,6 +347,19 @@ indent = { tab-width = 2, unit = " " }
|
||||
name = "protobuf"
|
||||
source = { git = "https://github.com/yusdacra/tree-sitter-protobuf", rev = "19c211a01434d9f03efff99f85e19f967591b175"}
|
||||
|
||||
[[language]]
|
||||
name = "textproto"
|
||||
file-types = ["txtpb", "textpb", "textproto"]
|
||||
comment-token = "#"
|
||||
scope = "source.textproto"
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
formatter = { command = "txtpbfmt" }
|
||||
auto-format = true
|
||||
|
||||
[[grammar]]
|
||||
name = "textproto"
|
||||
source = { git = "https://github.com/PorterAtGoogle/tree-sitter-textproto", rev = "568471b80fd8793d37ed01865d8c2208a9fefd1b"}
|
||||
|
||||
[[language]]
|
||||
name = "elixir"
|
||||
scope = "source.elixir"
|
||||
@ -451,6 +467,7 @@ file-types = [
|
||||
"avsc",
|
||||
"ldtk",
|
||||
"ldtkl",
|
||||
{ glob = ".swift-format" },
|
||||
]
|
||||
language-servers = [ "vscode-json-language-server" ]
|
||||
auto-format = true
|
||||
@ -464,7 +481,7 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-json", rev = "73076
|
||||
name = "jsonc"
|
||||
scope = "source.json"
|
||||
injection-regex = "jsonc"
|
||||
file-types = ["jsonc"]
|
||||
file-types = ["jsonc", { glob = "tsconfig.json" }]
|
||||
grammar = "json"
|
||||
language-servers = [ "vscode-json-language-server" ]
|
||||
auto-format = true
|
||||
@ -729,6 +746,7 @@ injection-regex = "(js|javascript)"
|
||||
language-id = "javascript"
|
||||
file-types = ["js", "mjs", "cjs", "rules", "es6", "pac", { glob = ".node_repl_history" }, { glob = "jakefile" }]
|
||||
shebangs = ["node"]
|
||||
roots = [ "package.json" ]
|
||||
comment-token = "//"
|
||||
block-comment-tokens = { start = "/*", end = "*/" }
|
||||
language-servers = [ "typescript-language-server" ]
|
||||
@ -756,6 +774,7 @@ scope = "source.jsx"
|
||||
injection-regex = "jsx"
|
||||
language-id = "javascriptreact"
|
||||
file-types = ["jsx"]
|
||||
roots = [ "package.json" ]
|
||||
comment-token = "//"
|
||||
block-comment-tokens = { start = "/*", end = "*/" }
|
||||
language-servers = [ "typescript-language-server" ]
|
||||
@ -769,6 +788,7 @@ injection-regex = "(ts|typescript)"
|
||||
language-id = "typescript"
|
||||
file-types = ["ts", "mts", "cts"]
|
||||
shebangs = ["deno", "bun", "ts-node"]
|
||||
roots = [ "package.json", "tsconfig.json" ]
|
||||
comment-token = "//"
|
||||
block-comment-tokens = { start = "/*", end = "*/" }
|
||||
language-servers = [ "typescript-language-server" ]
|
||||
@ -801,6 +821,7 @@ scope = "source.tsx"
|
||||
injection-regex = "(tsx)" # |typescript
|
||||
language-id = "typescriptreact"
|
||||
file-types = ["tsx"]
|
||||
roots = [ "package.json", "tsconfig.json" ]
|
||||
comment-token = "//"
|
||||
block-comment-tokens = { start = "/*", end = "*/" }
|
||||
language-servers = [ "typescript-language-server" ]
|
||||
@ -1151,7 +1172,7 @@ indent = { tab-width = 4, unit = " " }
|
||||
|
||||
[[grammar]]
|
||||
name = "julia"
|
||||
source = { git = "https://github.com/tree-sitter/tree-sitter-julia", rev = "8fb38abff74652c4faddbf04d2d5bbbc6b4bae25" }
|
||||
source = { git = "https://github.com/tree-sitter/tree-sitter-julia", rev = "e84f10db8eeb8b9807786bfc658808edaa1b4fa2" }
|
||||
|
||||
[[language]]
|
||||
name = "java"
|
||||
@ -1305,7 +1326,7 @@ source = { git = "https://github.com/ikatyang/tree-sitter-vue", rev = "91fe27547
|
||||
[[language]]
|
||||
name = "yaml"
|
||||
scope = "source.yaml"
|
||||
file-types = ["yml", "yaml", { glob = ".prettierrc" }]
|
||||
file-types = ["yml", "yaml", { glob = ".prettierrc" }, { glob = ".clangd" }, { glob = ".clang-format" }]
|
||||
comment-token = "#"
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
language-servers = [ "yaml-language-server", "ansible-language-server" ]
|
||||
@ -1315,6 +1336,15 @@ injection-regex = "yml|yaml"
|
||||
name = "yaml"
|
||||
source = { git = "https://github.com/ikatyang/tree-sitter-yaml", rev = "0e36bed171768908f331ff7dff9d956bae016efb" }
|
||||
|
||||
[[language]]
|
||||
name = "nestedtext"
|
||||
scope = "text.nested"
|
||||
injection-regex = "nestedtext"
|
||||
file-types = ["nt"]
|
||||
comment-token = "#"
|
||||
indent = { tab-width = 4, unit = " " }
|
||||
grammar = "yaml"
|
||||
|
||||
[[language]]
|
||||
name = "haskell"
|
||||
scope = "source.haskell"
|
||||
@ -1365,7 +1395,7 @@ injection-regex = "zig"
|
||||
file-types = ["zig", "zon"]
|
||||
roots = ["build.zig"]
|
||||
auto-format = true
|
||||
comment-token = "//"
|
||||
comment-tokens = ["//", "///", "//!"]
|
||||
language-servers = [ "zls" ]
|
||||
indent = { tab-width = 4, unit = " " }
|
||||
formatter = { command = "zig" , args = ["fmt", "--stdin"] }
|
||||
@ -1470,7 +1500,7 @@ indent = { tab-width = 2, unit = " " }
|
||||
|
||||
[[grammar]]
|
||||
name = "perl"
|
||||
source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "e99bb5283805db4cb86c964722d709df21b0ac16" }
|
||||
source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "72a08a496a23212f23802490ef6f4700d68cfd0e" }
|
||||
|
||||
[[language]]
|
||||
name = "pod"
|
||||
@ -1480,7 +1510,7 @@ file-types = ["pod"]
|
||||
|
||||
[[grammar]]
|
||||
name = "pod"
|
||||
source = { git = "https://github.com/tree-sitter-perl/tree-sitter-pod", rev = "39da859947b94abdee43e431368e1ae975c0a424" }
|
||||
source = { git = "https://github.com/tree-sitter-perl/tree-sitter-pod", rev = "0bf8387987c21bf2f8ed41d2575a8f22b139687f" }
|
||||
|
||||
[[language]]
|
||||
name = "racket"
|
||||
@ -1542,7 +1572,7 @@ injection-regex = "llvm"
|
||||
|
||||
[[grammar]]
|
||||
name = "llvm"
|
||||
source = { git = "https://github.com/benwilliamgraham/tree-sitter-llvm", rev = "e9948edc41e9e5869af99dddb2b5ff5cc5581af6" }
|
||||
source = { git = "https://github.com/benwilliamgraham/tree-sitter-llvm", rev = "c14cb839003348692158b845db9edda201374548" }
|
||||
|
||||
[[language]]
|
||||
name = "llvm-mir"
|
||||
@ -1554,7 +1584,7 @@ injection-regex = "mir"
|
||||
|
||||
[[grammar]]
|
||||
name = "llvm-mir"
|
||||
source = { git = "https://github.com/Flakebi/tree-sitter-llvm-mir", rev = "06fabca19454b2dc00c1b211a7cb7ad0bc2585f1" }
|
||||
source = { git = "https://github.com/Flakebi/tree-sitter-llvm-mir", rev = "d166ff8c5950f80b0a476956e7a0ad2f27c12505" }
|
||||
|
||||
[[language]]
|
||||
name = "llvm-mir-yaml"
|
||||
@ -1577,13 +1607,13 @@ injection-regex = "tablegen"
|
||||
|
||||
[[grammar]]
|
||||
name = "tablegen"
|
||||
source = { git = "https://github.com/Flakebi/tree-sitter-tablegen", rev = "568dd8a937347175fd58db83d4c4cdaeb6069bd2" }
|
||||
source = { git = "https://github.com/Flakebi/tree-sitter-tablegen", rev = "3e9c4822ab5cdcccf4f8aa9dcd42117f736d51d9" }
|
||||
|
||||
[[language]]
|
||||
name = "markdown"
|
||||
scope = "source.md"
|
||||
injection-regex = "md|markdown"
|
||||
file-types = ["md", "markdown", "mdx", "mkd", "mkdn", "mdwn", "mdown", "markdn", "mdtxt", "mdtext", "workbook", { glob = "PULLREQ_EDITMSG" }]
|
||||
file-types = ["md", "livemd", "markdown", "mdx", "mkd", "mkdn", "mdwn", "mdown", "markdn", "mdtxt", "mdtext", "workbook", { glob = "PULLREQ_EDITMSG" }]
|
||||
roots = [".marksman.toml"]
|
||||
language-servers = [ "marksman", "markdown-oxide" ]
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
@ -1658,7 +1688,7 @@ language-servers = [ "docker-langserver" ]
|
||||
|
||||
[[grammar]]
|
||||
name = "dockerfile"
|
||||
source = { git = "https://github.com/camdencheek/tree-sitter-dockerfile", rev = "8ee3a0f7587b2bd8c45c8cb7d28bd414604aec62" }
|
||||
source = { git = "https://github.com/camdencheek/tree-sitter-dockerfile", rev = "868e44ce378deb68aac902a9db68ff82d2299dd0" }
|
||||
|
||||
[[language]]
|
||||
name = "docker-compose"
|
||||
@ -1808,7 +1838,7 @@ indent = { tab-width = 2, unit = " " }
|
||||
|
||||
[[grammar]]
|
||||
name = "rescript"
|
||||
source = { git = "https://github.com/jaredramirez/tree-sitter-rescript", rev = "467dcf99f68c47823d7b378779a6b282d7ef9782" }
|
||||
source = { git = "https://github.com/rescript-lang/tree-sitter-rescript", rev = "5e2a44a9d886b0a509f5bfd0437d33b4871fbac5" }
|
||||
|
||||
[[language]]
|
||||
name = "erlang"
|
||||
@ -1918,7 +1948,7 @@ indent = { tab-width = 4, unit = " " }
|
||||
|
||||
[[grammar]]
|
||||
name = "ron"
|
||||
source = { git = "https://github.com/zee-editor/tree-sitter-ron", rev = "7762d709a0f7c1f9e269d0125a2e8a7a69006146" }
|
||||
source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-ron", rev = "78938553b93075e638035f624973083451b29055" }
|
||||
|
||||
[[language]]
|
||||
name = "robot"
|
||||
@ -1967,7 +1997,6 @@ roots = [ "Package.swift" ]
|
||||
comment-token = "//"
|
||||
block-comment-tokens = { start = "/*", end = "*/" }
|
||||
formatter = { command = "swift-format" }
|
||||
auto-format = true
|
||||
language-servers = [ "sourcekit-lsp" ]
|
||||
|
||||
[[grammar]]
|
||||
@ -2202,7 +2231,7 @@ source = { git = "https://github.com/staysail/tree-sitter-meson", rev = "32a83e8
|
||||
[[language]]
|
||||
name = "sshclientconfig"
|
||||
scope = "source.sshclientconfig"
|
||||
file-types = [{ glob = ".ssh/config" }, { glob = "/etc/ssh/ssh_config" }]
|
||||
file-types = [{ glob = ".ssh/config" }, { glob = "/etc/ssh/ssh_config" }, { glob = "ssh_config.d/*.conf" } ]
|
||||
comment-token = "#"
|
||||
|
||||
[[grammar]]
|
||||
@ -2410,7 +2439,7 @@ formatter = { command = "cue", args = ["fmt", "-"] }
|
||||
|
||||
[[grammar]]
|
||||
name = "cue"
|
||||
source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "61843e3beebf19417e4fede4e8be4df1084317ad" }
|
||||
source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "8a5f273bfa281c66354da562f2307c2d394b6c81" }
|
||||
|
||||
[[language]]
|
||||
name = "slint"
|
||||
@ -2793,7 +2822,7 @@ source = { git = "https://github.com/inko-lang/tree-sitter-inko", rev = "7860637
|
||||
[[language]]
|
||||
name = "bicep"
|
||||
scope = "source.bicep"
|
||||
file-types = ["bicep"]
|
||||
file-types = ["bicep","bicepparam"]
|
||||
auto-format = true
|
||||
comment-token = "//"
|
||||
block-comment-tokens = { start = "/*", end = "*/" }
|
||||
@ -2802,7 +2831,7 @@ language-servers = [ "bicep-langserver" ]
|
||||
|
||||
[[grammar]]
|
||||
name = "bicep"
|
||||
source = { git = "https://github.com/the-mikedavis/tree-sitter-bicep", rev = "d8e097fcfa143854861ef737161163a09cc2916b" }
|
||||
source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-bicep", rev = "0092c7d1bd6bb22ce0a6f78497d50ea2b87f19c0" }
|
||||
|
||||
[[language]]
|
||||
name = "qml"
|
||||
@ -2983,7 +3012,7 @@ indent = { tab-width = 8, unit = " " }
|
||||
|
||||
[[grammar]]
|
||||
name = "nasm"
|
||||
source = { git = "https://github.com/naclsn/tree-sitter-nasm", rev = "a0db15db6fcfb1bf2cc8702500e55e558825c48b" }
|
||||
source = { git = "https://github.com/naclsn/tree-sitter-nasm", rev = "570f3d7be01fffc751237f4cfcf52d04e20532d1" }
|
||||
|
||||
[[language]]
|
||||
name = "gas"
|
||||
@ -3316,7 +3345,7 @@ indent = { tab-width = 4, unit = " " }
|
||||
|
||||
[[grammar]]
|
||||
name = "unison"
|
||||
source = { git = "https://github.com/kylegoetz/tree-sitter-unison", rev = "1f505e2447fa876a87aee47ff3d70b9e141c744f" }
|
||||
source = { git = "https://github.com/kylegoetz/tree-sitter-unison", rev = "3c97db76d3cdbd002dfba493620c2d5df2fd6fa9" }
|
||||
|
||||
[[language]]
|
||||
name = "todotxt"
|
||||
@ -3550,6 +3579,7 @@ roots = ["hyprland.conf"]
|
||||
file-types = [ { glob = "hyprland.conf" }, { glob = "hyprpaper.conf" }, { glob = "hypridle.conf" }, { glob = "hyprlock.conf" } ]
|
||||
comment-token = "#"
|
||||
grammar = "hyprlang"
|
||||
language-servers = ["hyprls"]
|
||||
|
||||
[[grammar]]
|
||||
name = "hyprlang"
|
||||
@ -3839,11 +3869,15 @@ source = { git = "https://github.com/Decurity/tree-sitter-circom", rev = "021505
|
||||
name = "snakemake"
|
||||
scope = "source.snakemake"
|
||||
roots = ["Snakefile", "config.yaml", "environment.yaml", "workflow/"]
|
||||
file-types = ["smk", "Snakefile"]
|
||||
file-types = ["smk", { glob = "Snakefile" } ]
|
||||
comment-tokens = ["#", "##"]
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
language-servers = ["pylsp" ]
|
||||
|
||||
[language.formatter]
|
||||
command = "snakefmt"
|
||||
args = ["-"]
|
||||
|
||||
[[grammar]]
|
||||
name = "snakemake"
|
||||
source = { git = "https://github.com/osthomas/tree-sitter-snakemake", rev = "e909815acdbe37e69440261ebb1091ed52e1dec6" }
|
||||
@ -3859,3 +3893,41 @@ indent = { tab-width = 4, unit = " " }
|
||||
[[grammar]]
|
||||
name = "cylc"
|
||||
source = { git = "https://github.com/elliotfontaine/tree-sitter-cylc", rev = "30dd40d9bf23912e4aefa93eeb4c7090bda3d0f6" }
|
||||
|
||||
[[language]]
|
||||
name = "quint"
|
||||
scope = "source.quint"
|
||||
file-types = ["qnt"]
|
||||
language-servers = ["quint-language-server"]
|
||||
comment-token = "//"
|
||||
block-comment-tokens = { start = "/*", end = "*/" }
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
|
||||
[[grammar]]
|
||||
name = "quint"
|
||||
source = { git = "https://github.com/gruhn/tree-sitter-quint", rev = "eebbd01edfeff6404778c92efe5554e42e506a18" }
|
||||
|
||||
[[language]]
|
||||
name = "spade"
|
||||
scope = "source.spade"
|
||||
roots = ["swim.toml"]
|
||||
file-types = ['spade']
|
||||
injection-regex = "spade"
|
||||
comment-tokens = ["//", "///"]
|
||||
block-comment-tokens = [
|
||||
{ start = "/*", end = "*/" },
|
||||
{ start = "/**", end = "*/" },
|
||||
]
|
||||
language-servers = [ "spade-language-server" ]
|
||||
indent = { tab-width = 4, unit = " " }
|
||||
|
||||
[language.auto-pairs]
|
||||
'(' = ')'
|
||||
'{' = '}'
|
||||
'[' = ']'
|
||||
'"' = '"'
|
||||
'<' = '>'
|
||||
|
||||
[[grammar]]
|
||||
name = "spade"
|
||||
source = { git = "https://gitlab.com/spade-lang/tree-sitter-spade/", rev = "4d5b141017c61fe7e168e0a5c5721ee62b0d9572" }
|
||||
|
24
pr.md
Normal file
24
pr.md
Normal file
@ -0,0 +1,24 @@
|
||||
Syntax symbol pickers
|
||||
==
|
||||
|
||||
This adds two new symbol picker commands that use tree-sitter rather than LSP. We run a new `symbols.scm` query across the file and extract tagged things like function definitions, types, classes, etc. For languages with unambiguous syntax this behaves roughly the same as the LSP symbol picker (`<space>s`). It's less precise though since we don't have semantic info about the language. For example it can easily produce false positives for C/C++ because of preprocessor magic.
|
||||
|
||||
The hope is to start introducing LSP-like features for navigation that can work without installing or running a language server. I made these two pickers in particular because I don't like LSP equivalents in ErlangLS - the document symbol picker can take a long time to show up during boot and the workspace symbol picker only searches for module names. The other motivation is to have some navigation features in cases when running a language server is too cumbersome - either to set up or because of resource constraints. For example `clangd` needs a fair amount of setup (`compile_commands.json`) that you might not want to do when quickly reading through a codebase.
|
||||
|
||||
GitHub already uses tree-sitter like this to provide [imprecise code navigation](https://docs.github.com/en/repositories/working-with-files/using-files/navigating-code-on-github#about-navigating-code-on-github). It should be possible to find definitions and references as well like `gd` and `gr` - this is left as a follow-up.
|
||||
|
||||
This PR also adds commands that either open the LSP symbol picker or the syntax one if a language server is not available. This way you can customize a language to not use the LSP symbol pickers, for example:
|
||||
|
||||
```toml
|
||||
[[language]]
|
||||
name = "erlang"
|
||||
language-servers = [{ name = "erlang-ls", except-features = ["document-symbols", "workspace-symbols"] }]
|
||||
```
|
||||
|
||||
and `<space>s` will use the syntax symbol picker, while `<space>s` on a Rust file will still prefer the language server.
|
||||
|
||||
---
|
||||
|
||||
Outstanding question - how closely should we try to match LSP symbol kind? Not at all? Should we have markup specific symbol kinds? (For example see markdown's `symbols.scm`).
|
||||
|
||||
Also this PR needs docs on writing `symbols.scm` queries.
|
@ -109,14 +109,15 @@
|
||||
(number) @constant.numeric
|
||||
(string) @string
|
||||
|
||||
(func_call name: (identifier) @function)
|
||||
(func_def name: (identifier) @function)
|
||||
|
||||
(field_ref (_) @variable)
|
||||
[
|
||||
(identifier)
|
||||
(field_ref)
|
||||
] @variable
|
||||
|
||||
(func_call name: (identifier) @function)
|
||||
(func_def name: (identifier) @function)
|
||||
|
||||
(field_ref (_) @variable)
|
||||
|
||||
(ns_qualified_name "::" @operator)
|
||||
(ns_qualified_name (namespace) @namespace)
|
||||
|
@ -12,7 +12,10 @@
|
||||
|
||||
(command_name) @function
|
||||
|
||||
(variable_name) @variable.other.member
|
||||
(variable_name) @variable
|
||||
|
||||
((variable_name) @constant
|
||||
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
|
||||
[
|
||||
"if"
|
||||
@ -48,6 +51,9 @@
|
||||
|
||||
(comment) @comment
|
||||
|
||||
((word) @constant.builtin.boolean
|
||||
(#any-of? @constant.builtin.boolean "true" "false"))
|
||||
|
||||
(function_definition name: (word) @function)
|
||||
|
||||
(file_descriptor) @constant.numeric.integer
|
||||
|
@ -1,73 +1,232 @@
|
||||
; Keywords
|
||||
|
||||
; Includes
|
||||
[
|
||||
"module"
|
||||
"var"
|
||||
"param"
|
||||
"import"
|
||||
"resource"
|
||||
"existing"
|
||||
"if"
|
||||
"targetScope"
|
||||
"output"
|
||||
] @keyword
|
||||
"provider"
|
||||
"with"
|
||||
"as"
|
||||
"from"
|
||||
] @keyword.control.import
|
||||
|
||||
; Namespaces
|
||||
(module_declaration
|
||||
(identifier) @namespace)
|
||||
|
||||
; Builtins
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
((member_expression
|
||||
object: (identifier) @type.builtin)
|
||||
(#eq? @type.builtin "sys"))
|
||||
|
||||
; Functions
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(decorator) @function.builtin
|
||||
(user_defined_function
|
||||
name: (identifier) @function)
|
||||
|
||||
(functionCall) @function
|
||||
; Properties
|
||||
(object_property
|
||||
(identifier) @function.method
|
||||
":" @punctuation.delimiter
|
||||
(_))
|
||||
|
||||
(functionCall
|
||||
(functionArgument
|
||||
(variableAccess) @variable))
|
||||
(object_property
|
||||
(compatible_identifier) @function.method
|
||||
":" @punctuation.delimiter
|
||||
(_))
|
||||
|
||||
; Literals/Types
|
||||
(property_identifier) @function.method
|
||||
|
||||
; Attributes
|
||||
(decorator
|
||||
"@" @attribute)
|
||||
|
||||
(decorator
|
||||
(call_expression
|
||||
(identifier) @attribute))
|
||||
|
||||
(decorator
|
||||
(call_expression
|
||||
(member_expression
|
||||
object: (identifier) @attribute
|
||||
property: (property_identifier) @attribute)))
|
||||
|
||||
; Types
|
||||
(type_declaration
|
||||
(identifier) @type)
|
||||
|
||||
(type_declaration
|
||||
(identifier)
|
||||
"="
|
||||
(identifier) @type)
|
||||
|
||||
(type
|
||||
(identifier) @type)
|
||||
|
||||
(resource_declaration
|
||||
(identifier) @type)
|
||||
|
||||
(resource_expression
|
||||
(identifier) @type)
|
||||
|
||||
; Parameters
|
||||
(parameter_declaration
|
||||
(identifier) @variable.parameter
|
||||
(_))
|
||||
|
||||
(call_expression
|
||||
function: (_)
|
||||
(arguments
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(call_expression
|
||||
function: (_)
|
||||
(arguments
|
||||
(member_expression
|
||||
object: (identifier) @variable.parameter)))
|
||||
|
||||
(parameter
|
||||
.
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Variables
|
||||
(variable_declaration
|
||||
(identifier) @variable
|
||||
(_))
|
||||
|
||||
(metadata_declaration
|
||||
(identifier) @variable
|
||||
(_))
|
||||
|
||||
(output_declaration
|
||||
(identifier) @variable
|
||||
(_))
|
||||
|
||||
(object_property
|
||||
(_)
|
||||
":"
|
||||
(identifier) @variable)
|
||||
|
||||
(for_statement
|
||||
"for"
|
||||
(for_loop_parameters
|
||||
(loop_variable) @variable
|
||||
(loop_enumerator) @variable))
|
||||
|
||||
; Conditionals
|
||||
"if" @keyword.conditional
|
||||
|
||||
(ternary_expression
|
||||
"?" @keyword.control.conditional
|
||||
":" @keyword.control.conditional)
|
||||
|
||||
; Loops
|
||||
(for_statement
|
||||
"for" @keyword.control.repeat
|
||||
"in"
|
||||
":" @punctuation.delimiter)
|
||||
|
||||
; Keywords
|
||||
[
|
||||
"module"
|
||||
"metadata"
|
||||
"output"
|
||||
"param"
|
||||
"resource"
|
||||
"existing"
|
||||
"targetScope"
|
||||
"type"
|
||||
"var"
|
||||
"using"
|
||||
"test"
|
||||
] @keyword
|
||||
|
||||
"func" @keyword.function
|
||||
|
||||
"assert" @keyword.control.exception
|
||||
|
||||
; Operators
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"||"
|
||||
"&&"
|
||||
"|"
|
||||
"=="
|
||||
"!="
|
||||
"=~"
|
||||
"!~"
|
||||
">"
|
||||
">="
|
||||
"<="
|
||||
"<"
|
||||
"??"
|
||||
"="
|
||||
"!"
|
||||
".?"
|
||||
] @operator
|
||||
|
||||
(subscript_expression
|
||||
"?" @operator)
|
||||
|
||||
(nullable_type
|
||||
"?" @operator)
|
||||
|
||||
"in" @keyword.operator
|
||||
|
||||
; Literals
|
||||
(string) @string
|
||||
|
||||
(escape_sequence) @constant.character
|
||||
|
||||
(number) @constant.number
|
||||
|
||||
(boolean) @constant.builtin.boolean
|
||||
|
||||
(null) @constant.builtin
|
||||
|
||||
; Misc
|
||||
(compatible_identifier
|
||||
"?" @punctuation.special)
|
||||
|
||||
(nullable_return_type) @punctuation.special
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
(resourceDeclaration
|
||||
(string
|
||||
(stringLiteral) @string.special))
|
||||
|
||||
(moduleDeclaration
|
||||
(string
|
||||
(stringLiteral) @string.special))
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
(string)
|
||||
(stringLiteral)
|
||||
] @string
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
(nullLiteral) @keyword
|
||||
(booleanLiteral) @constant.builtin.boolean
|
||||
(integerLiteral) @constant.numeric.integer
|
||||
(comment) @comment
|
||||
[
|
||||
"."
|
||||
":"
|
||||
"::"
|
||||
"=>"
|
||||
] @punctuation.delimiter
|
||||
|
||||
(string
|
||||
(variableAccess
|
||||
(identifier) @variable))
|
||||
; Interpolation
|
||||
(interpolation
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special)
|
||||
|
||||
(type) @type
|
||||
(interpolation
|
||||
(identifier) @variable)
|
||||
|
||||
; Variables
|
||||
|
||||
(localVariable) @variable
|
||||
|
||||
; Statements
|
||||
|
||||
(object
|
||||
(objectProperty
|
||||
(identifier) @identifier))
|
||||
|
||||
(propertyAccess
|
||||
(identifier) @identifier)
|
||||
|
||||
(ifCondition) @keyword.control.conditional
|
||||
; Comments
|
||||
[
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @comment
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
"sizeof" @keyword
|
||||
|
||||
[
|
||||
@ -109,6 +115,12 @@
|
||||
(char_literal) @constant.character
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
(field_identifier) @variable.other.member
|
||||
(statement_identifier) @label
|
||||
(type_identifier) @type
|
||||
(primitive_type) @type.builtin
|
||||
(sized_type_specifier) @type.builtin
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
(call_expression
|
||||
@ -128,15 +140,4 @@
|
||||
(attribute
|
||||
name: (identifier) @attribute)
|
||||
|
||||
(field_identifier) @variable.other.member
|
||||
(statement_identifier) @label
|
||||
(type_identifier) @type
|
||||
(primitive_type) @type.builtin
|
||||
(sized_type_specifier) @type.builtin
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(comment) @comment
|
||||
|
@ -1,7 +1,9 @@
|
||||
; Preproc
|
||||
|
||||
(unique_id) @keyword.directive
|
||||
(top_level_annotation_body) @keyword.directive
|
||||
[
|
||||
(unique_id)
|
||||
(top_level_annotation_body)
|
||||
] @keyword.directive
|
||||
|
||||
; Includes
|
||||
|
||||
@ -9,6 +11,7 @@
|
||||
"import"
|
||||
"$import"
|
||||
"embed"
|
||||
"using"
|
||||
] @keyword.control.import
|
||||
|
||||
(import_path) @string
|
||||
@ -84,10 +87,10 @@
|
||||
"union"
|
||||
] @keyword.storage.type
|
||||
|
||||
"extends" @keyword
|
||||
|
||||
[
|
||||
"extends"
|
||||
"namespace"
|
||||
"using"
|
||||
(annotation_target)
|
||||
] @special
|
||||
|
||||
|
@ -22,16 +22,10 @@
|
||||
"in"
|
||||
] @keyword
|
||||
|
||||
; Function calls
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(member_call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
; Identifiers
|
||||
|
||||
(identifier) @variable.other.member
|
||||
|
||||
(select_expression
|
||||
operand: (identifier) @type)
|
||||
|
||||
@ -39,7 +33,13 @@
|
||||
operand: (select_expression
|
||||
member: (identifier) @type))
|
||||
|
||||
(identifier) @variable.other.member
|
||||
; Function calls
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(member_call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
; Literals
|
||||
|
||||
|
@ -10,6 +10,14 @@
|
||||
|
||||
(comment) @comment
|
||||
|
||||
;; other symbols
|
||||
(sym_lit) @variable
|
||||
|
||||
;; other calls
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @function)
|
||||
|
||||
;; metadata experiment
|
||||
(meta_lit
|
||||
marker: "^" @punctuation)
|
||||
@ -61,20 +69,12 @@
|
||||
((sym_lit) @operator
|
||||
(#match? @operator "^%"))
|
||||
|
||||
;; other calls
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @function)
|
||||
|
||||
;; interop-ish
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @function.method
|
||||
(#match? @function.method "^\\."))
|
||||
|
||||
;; other symbols
|
||||
(sym_lit) @variable
|
||||
|
||||
;; quote
|
||||
(quoting_lit) @constant.character.escape
|
||||
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
; Error level tags
|
||||
((tag (name) @error)
|
||||
(#match? @error "^(BUG|FIXME|ISSUE|XXX|FIX|SAFETY|FIXIT|FAILED|DEBUG)$"))
|
||||
(#match? @error "^(BUG|FIXME|ISSUE|XXX|FIX|SAFETY|FIXIT|FAILED|DEBUG|INVARIANT)$"))
|
||||
|
||||
("text" @error
|
||||
(#match? @error "^(BUG|FIXME|ISSUE|XXX|FIX|SAFETY|FIXIT|FAILED|DEBUG)$"))
|
||||
(#match? @error "^(BUG|FIXME|ISSUE|XXX|FIX|SAFETY|FIXIT|FAILED|DEBUG|INVARIANT)$"))
|
||||
|
||||
(tag
|
||||
(name) @ui.text
|
||||
|
@ -1,3 +1,5 @@
|
||||
; inherits: c
|
||||
|
||||
; Functions
|
||||
|
||||
; These casts are parsed as function calls, but are not.
|
||||
@ -132,5 +134,3 @@
|
||||
; Strings
|
||||
|
||||
(raw_string_literal) @string
|
||||
|
||||
; inherits: c
|
||||
|
@ -1,12 +1,46 @@
|
||||
(package_clause "package" @keyword.control.import)
|
||||
; Includes
|
||||
[
|
||||
"package"
|
||||
"import"
|
||||
] @keyword.control.import
|
||||
|
||||
(package_identifier) @variable
|
||||
; Namespaces
|
||||
(package_identifier) @namespace
|
||||
|
||||
(import_declaration "import" @keyword.control.import)
|
||||
(import_spec
|
||||
[
|
||||
"."
|
||||
"_"
|
||||
] @punctuation.special)
|
||||
|
||||
[
|
||||
"!"
|
||||
(attr_path)
|
||||
(package_path)
|
||||
] @string.special.url ; In attributes
|
||||
|
||||
; Attributes
|
||||
(attribute) @attribute
|
||||
|
||||
; Conditionals
|
||||
"if" @keyword.control.conditional
|
||||
|
||||
; Repeats
|
||||
"for" @keyword.control.repeat
|
||||
|
||||
(for_clause
|
||||
"_" @punctuation.special)
|
||||
|
||||
; Keywords
|
||||
"let" @keyword
|
||||
|
||||
"in" @keyword.operator
|
||||
|
||||
; Operators
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"|"
|
||||
"&"
|
||||
"||"
|
||||
@ -19,92 +53,103 @@
|
||||
">="
|
||||
"=~"
|
||||
"!~"
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"!"
|
||||
"="
|
||||
] @operator
|
||||
|
||||
(unary_expression "*" @operator.default)
|
||||
; Fields & Properties
|
||||
(field
|
||||
(label
|
||||
(identifier) @variable.other.member))
|
||||
|
||||
(unary_expression "=~" @operator.regexp)
|
||||
(selector_expression
|
||||
(_)
|
||||
(identifier) @variable.other.member)
|
||||
|
||||
(unary_expression "!~" @operator.regexp)
|
||||
; Functions
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(binary_expression _ "&" @operator.unify _)
|
||||
(call_expression
|
||||
function: (selector_expression
|
||||
(_)
|
||||
(identifier) @function))
|
||||
|
||||
(binary_expression _ "|" @operator.disjunct _)
|
||||
(call_expression
|
||||
function: (builtin_function) @function)
|
||||
|
||||
(builtin) @function.builtin
|
||||
(builtin_function) @function.builtin
|
||||
|
||||
(qualified_identifier) @function.builtin
|
||||
; Variables
|
||||
(identifier) @variable
|
||||
|
||||
(let_clause "let" @keyword.storage.type)
|
||||
; Types
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
(for_clause "for" @keyword.control.repeat)
|
||||
(for_clause "in" @keyword.control.repeat)
|
||||
|
||||
(guard_clause "if" @keyword.control.conditional)
|
||||
|
||||
(comment) @comment
|
||||
((identifier) @type
|
||||
(#match? @type "^_?#"))
|
||||
|
||||
[
|
||||
(string_type)
|
||||
(simple_string_lit)
|
||||
(multiline_string_lit)
|
||||
(bytes_type)
|
||||
(simple_bytes_lit)
|
||||
(multiline_bytes_lit)
|
||||
] @string
|
||||
|
||||
[
|
||||
(number_type)
|
||||
(int_lit)
|
||||
(int_type)
|
||||
(uint_type)
|
||||
] @constant.numeric.integer
|
||||
|
||||
[
|
||||
(float_lit)
|
||||
(float_type)
|
||||
] @constant.numeric.float
|
||||
|
||||
[
|
||||
(bool_type)
|
||||
(true)
|
||||
(false)
|
||||
] @constant.builtin.boolean
|
||||
|
||||
(null) @constant.builtin
|
||||
|
||||
(ellipsis) @punctuation.bracket
|
||||
(slice_type)
|
||||
(pointer_type)
|
||||
] @type ; In attributes
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket
|
||||
|
||||
(interpolation "\\(" @punctuation.bracket (_) ")" @punctuation.bracket) @variable.other.member
|
||||
[
|
||||
(ellipsis)
|
||||
"?"
|
||||
] @punctuation.special
|
||||
|
||||
(field (label (identifier) @variable.other.member))
|
||||
; Literals
|
||||
(string) @string
|
||||
|
||||
(
|
||||
(identifier) @keyword.storage.type
|
||||
(#match? @keyword.storage.type "^#")
|
||||
)
|
||||
[
|
||||
(escape_char)
|
||||
(escape_unicode)
|
||||
] @constant.character.escape
|
||||
|
||||
(field (label alias: (identifier) @label))
|
||||
(number) @constant.numeric
|
||||
|
||||
(let_clause left: (identifier) @label)
|
||||
(float) @constant.numeric.float
|
||||
|
||||
(si_unit
|
||||
(float)
|
||||
(_) @string.special.symbol)
|
||||
|
||||
(attribute (identifier) @tag)
|
||||
(boolean) @constant.builtin.boolean
|
||||
|
||||
[
|
||||
(null)
|
||||
(top)
|
||||
(bottom)
|
||||
] @constant.builtin
|
||||
|
||||
; Interpolations
|
||||
(interpolation
|
||||
"\\(" @punctuation.special
|
||||
(_)
|
||||
")" @punctuation.special)
|
||||
|
||||
(interpolation
|
||||
"\\("
|
||||
(identifier) @variable
|
||||
")")
|
||||
|
||||
; Comments
|
||||
(comment) @comment
|
||||
|
@ -51,14 +51,14 @@
|
||||
|
||||
(integer_literal) @constant.numeric.integer
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(labeled_item
|
||||
label: (identifier) @label)
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(unit_address) @tag
|
||||
|
||||
(reference) @constant
|
||||
|
@ -37,6 +37,15 @@
|
||||
|
||||
(double_quoted_string) @string
|
||||
|
||||
[
|
||||
(heredoc_marker)
|
||||
(heredoc_end)
|
||||
] @label
|
||||
|
||||
((heredoc_block
|
||||
(heredoc_line) @string)
|
||||
(#set! "priority" 90))
|
||||
|
||||
(expansion
|
||||
[
|
||||
"$"
|
||||
@ -52,3 +61,6 @@
|
||||
(param)
|
||||
(mount_param)
|
||||
] @constant
|
||||
|
||||
(expose_instruction
|
||||
(expose_port) @constant.numeric.integer)
|
||||
|
@ -1,3 +1,5 @@
|
||||
(identifier) @variable
|
||||
|
||||
(keyword) @keyword
|
||||
(string_literal) @string
|
||||
(number_literal) @constant.numeric
|
||||
@ -33,11 +35,9 @@
|
||||
(identifier) @constant)
|
||||
)
|
||||
|
||||
[
|
||||
(comment)
|
||||
(preproc)
|
||||
] @comment
|
||||
(comment) @comment
|
||||
|
||||
(preproc) @keyword.directive
|
||||
|
||||
(ERROR) @error
|
||||
|
||||
(identifier) @variable
|
||||
|
@ -1,3 +1,45 @@
|
||||
; Comments
|
||||
(tripledot) @comment.discard
|
||||
|
||||
[(comment) (line_comment) (shebang)] @comment
|
||||
|
||||
; Basic types
|
||||
(variable) @variable
|
||||
((atom) @constant.builtin.boolean
|
||||
(#match? @constant.builtin.boolean "^(true|false)$"))
|
||||
(atom) @string.special.symbol
|
||||
[(string) (sigil)] @string
|
||||
(character) @constant.character
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
(integer) @constant.numeric.integer
|
||||
(float) @constant.numeric.float
|
||||
|
||||
; Punctuation
|
||||
["," "." "-" ";"] @punctuation.delimiter
|
||||
["(" ")" "#" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket
|
||||
|
||||
; Operators
|
||||
(binary_operator
|
||||
left: (atom) @function
|
||||
operator: "/"
|
||||
right: (integer) @constant.numeric.integer)
|
||||
|
||||
((binary_operator operator: _ @keyword.operator)
|
||||
(#match? @keyword.operator "^\\w+$"))
|
||||
((unary_operator operator: _ @keyword.operator)
|
||||
(#match? @keyword.operator "^\\w+$"))
|
||||
|
||||
(binary_operator operator: _ @operator)
|
||||
(unary_operator operator: _ @operator)
|
||||
["/" ":" "->"] @operator
|
||||
|
||||
|
||||
; Keywords
|
||||
(attribute name: (atom) @keyword)
|
||||
|
||||
["case" "fun" "if" "of" "when" "end" "receive" "try" "catch" "after" "begin" "maybe"] @keyword
|
||||
|
||||
; Attributes
|
||||
; module declaration
|
||||
(attribute
|
||||
@ -122,46 +164,3 @@
|
||||
|
||||
(record field: (atom) @variable.other.member)
|
||||
(record name: (atom) @type)
|
||||
|
||||
; Keywords
|
||||
(attribute name: (atom) @keyword)
|
||||
|
||||
["case" "fun" "if" "of" "when" "end" "receive" "try" "catch" "after" "begin" "maybe"] @keyword
|
||||
|
||||
; Operators
|
||||
(binary_operator
|
||||
left: (atom) @function
|
||||
operator: "/"
|
||||
right: (integer) @constant.numeric.integer)
|
||||
|
||||
((binary_operator operator: _ @keyword.operator)
|
||||
(#match? @keyword.operator "^\\w+$"))
|
||||
((unary_operator operator: _ @keyword.operator)
|
||||
(#match? @keyword.operator "^\\w+$"))
|
||||
|
||||
(binary_operator operator: _ @operator)
|
||||
(unary_operator operator: _ @operator)
|
||||
["/" ":" "->"] @operator
|
||||
|
||||
; Comments
|
||||
(tripledot) @comment.discard
|
||||
|
||||
[(comment) (line_comment) (shebang)] @comment
|
||||
|
||||
; Basic types
|
||||
(variable) @variable
|
||||
((atom) @constant.builtin.boolean
|
||||
(#match? @constant.builtin.boolean "^(true|false)$"))
|
||||
(atom) @string.special.symbol
|
||||
[(string) (sigil)] @string
|
||||
(character) @constant.character
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
(integer) @constant.numeric.integer
|
||||
(float) @constant.numeric.float
|
||||
|
||||
; Punctuation
|
||||
["," "." "-" ";"] @punctuation.delimiter
|
||||
["(" ")" "#" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket
|
||||
|
||||
; (ERROR) @error
|
||||
|
@ -1,8 +1,34 @@
|
||||
; Function calls
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.builtin
|
||||
(#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
|
||||
; Identifiers
|
||||
|
||||
(field_identifier) @variable.other.member
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(package_identifier) @namespace
|
||||
|
||||
(parameter_declaration (identifier) @variable.parameter)
|
||||
(variadic_parameter_declaration (identifier) @variable.parameter)
|
||||
|
||||
(const_spec
|
||||
name: (identifier) @constant)
|
||||
|
||||
(type_spec
|
||||
name: (type_identifier) @constructor)
|
||||
|
||||
(keyed_element (literal_element (identifier) @variable.other.member))
|
||||
(field_declaration
|
||||
name: (field_identifier) @variable.other.member)
|
||||
|
||||
(parameter_declaration (identifier) @variable.parameter)
|
||||
(variadic_parameter_declaration (identifier) @variable.parameter)
|
||||
|
||||
(label_name) @label
|
||||
|
||||
(const_spec
|
||||
name: (identifier) @constant)
|
||||
|
||||
; Function calls
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
@ -11,9 +37,14 @@
|
||||
function: (selector_expression
|
||||
field: (field_identifier) @function.method))
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.builtin
|
||||
(#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
|
||||
|
||||
; Types
|
||||
|
||||
(type_identifier) @type
|
||||
|
||||
(type_parameter_list
|
||||
(parameter_declaration
|
||||
name: (identifier) @type.parameter))
|
||||
@ -21,8 +52,6 @@
|
||||
((type_identifier) @type.builtin
|
||||
(#match? @type.builtin "^(any|bool|byte|comparable|complex128|complex64|error|float32|float64|int|int16|int32|int64|int8|rune|string|uint|uint16|uint32|uint64|uint8|uintptr)$"))
|
||||
|
||||
(type_identifier) @type
|
||||
|
||||
; Function definitions
|
||||
|
||||
(function_declaration
|
||||
@ -34,28 +63,6 @@
|
||||
(method_spec
|
||||
name: (field_identifier) @function.method)
|
||||
|
||||
; Identifiers
|
||||
|
||||
(const_spec
|
||||
name: (identifier) @constant)
|
||||
|
||||
(parameter_declaration (identifier) @variable.parameter)
|
||||
(variadic_parameter_declaration (identifier) @variable.parameter)
|
||||
|
||||
(type_spec
|
||||
name: (type_identifier) @constructor)
|
||||
(field_identifier) @variable.other.member
|
||||
(keyed_element (literal_element (identifier) @variable.other.member))
|
||||
(identifier) @variable
|
||||
(package_identifier) @namespace
|
||||
|
||||
(parameter_declaration (identifier) @variable.parameter)
|
||||
(variadic_parameter_declaration (identifier) @variable.parameter)
|
||||
|
||||
(label_name) @label
|
||||
|
||||
(const_spec
|
||||
name: (identifier) @constant)
|
||||
|
||||
; Operators
|
||||
|
||||
|
@ -1,17 +1,3 @@
|
||||
;; ----------------------------------------------------------------------------
|
||||
;; Literals and comments
|
||||
|
||||
(integer) @constant.numeric.integer
|
||||
(exp_negation) @constant.numeric.integer
|
||||
(exp_literal (float)) @constant.numeric.float
|
||||
(char) @constant.character
|
||||
(string) @string
|
||||
|
||||
(con_unit) @constant.builtin ; unit, as in ()
|
||||
|
||||
(comment) @comment
|
||||
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
;; Punctuation
|
||||
|
||||
@ -30,6 +16,20 @@
|
||||
] @punctuation.delimiter
|
||||
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
;; Literals and comments
|
||||
|
||||
(integer) @constant.numeric.integer
|
||||
(exp_negation) @constant.numeric.integer
|
||||
(exp_literal (float)) @constant.numeric.float
|
||||
(char) @constant.character
|
||||
(string) @string
|
||||
|
||||
(comment) @comment
|
||||
|
||||
(con_unit [ "(" ")" ] @constant.builtin) ; unit, as in ()
|
||||
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
;; Keywords, operators, includes
|
||||
|
||||
@ -103,6 +103,8 @@
|
||||
;; ----------------------------------------------------------------------------
|
||||
;; Functions and variables
|
||||
|
||||
(variable) @variable
|
||||
|
||||
(signature name: (variable) @type)
|
||||
(function
|
||||
name: (variable) @function
|
||||
@ -117,7 +119,6 @@
|
||||
(exp_apply . (exp_name (variable) @function))
|
||||
(exp_apply . (exp_name (qualified_variable (variable) @function)))
|
||||
|
||||
(variable) @variable
|
||||
(pat_wildcard) @variable
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
|
@ -10,12 +10,15 @@
|
||||
|
||||
(num_lit) @constant.numeric
|
||||
|
||||
[(bool_lit) (nil_lit)] @constant.builtin
|
||||
(bool_lit) @constant.builtin.boolean
|
||||
(nil_lit) @constant.builtin
|
||||
|
||||
(comment) @comment
|
||||
|
||||
((sym_lit) @variable
|
||||
(#match? @variable "^\\*.+\\*$"))
|
||||
(sym_lit) @variable
|
||||
|
||||
((sym_lit) @variable.builtin
|
||||
(#match? @variable.builtin "^\\*.+\\*$"))
|
||||
|
||||
(short_fn_lit
|
||||
.
|
||||
@ -57,8 +60,6 @@
|
||||
.
|
||||
(sym_lit) @function)
|
||||
|
||||
(sym_lit) @variable
|
||||
|
||||
["{" "@{" "}"
|
||||
"[" "@[" "]"
|
||||
"(" "@(" ")"] @punctuation.bracket
|
||||
|
@ -1,3 +1,5 @@
|
||||
(identifier) @variable
|
||||
|
||||
; Methods
|
||||
|
||||
(method_declaration
|
||||
@ -54,8 +56,6 @@
|
||||
((identifier) @constant
|
||||
(#match? @constant "^_*[A-Z][A-Z\\d_]+$"))
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(this) @variable.builtin
|
||||
|
||||
; Literals
|
||||
|
@ -3,9 +3,12 @@
|
||||
(struct_definition)
|
||||
(macro_definition)
|
||||
(function_definition)
|
||||
(compound_expression) ; begin blocks
|
||||
(let_statement)
|
||||
(if_statement)
|
||||
(try_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(let_statement)
|
||||
(quote_statement)
|
||||
(do_clause)
|
||||
(compound_statement) ; begin block
|
||||
] @fold
|
||||
|
@ -1,38 +1,47 @@
|
||||
; ----------
|
||||
; Primitives
|
||||
; ----------
|
||||
; ------------
|
||||
; Variables identifiers
|
||||
; ------------
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @comment
|
||||
(identifier) @variable
|
||||
|
||||
; Remaining identifiers that start with capital letters should be types (PascalCase)
|
||||
(
|
||||
((identifier) @constant.builtin)
|
||||
(#match? @constant.builtin "^(nothing|missing|undef)$"))
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @constant.builtin.boolean
|
||||
|
||||
(integer_literal) @constant.numeric.integer
|
||||
(float_literal) @constant.numeric.float
|
||||
(identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
; SCREAMING_SNAKE_CASE
|
||||
(
|
||||
((identifier) @constant.numeric.float)
|
||||
(#match? @constant.numeric.float "^((Inf|NaN)(16|32|64)?)$"))
|
||||
(identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_]*$"))
|
||||
|
||||
(character_literal) @constant.character
|
||||
(escape_sequence) @constant.character.escape
|
||||
(const_statement
|
||||
(assignment
|
||||
. (identifier) @constant))
|
||||
|
||||
(string_literal) @string
|
||||
|
||||
(prefixed_string_literal
|
||||
prefix: (identifier) @function.macro) @string
|
||||
; Field expressions are either module content or struct fields.
|
||||
; Module types and constants should already be captured, so this
|
||||
; assumes the remaining identifiers to be struct fields.
|
||||
(field_expression
|
||||
(_)
|
||||
(identifier) @variable.other.member)
|
||||
|
||||
(quote_expression
|
||||
(identifier) @string.special.symbol)
|
||||
":" @string.special.symbol
|
||||
[
|
||||
(identifier)
|
||||
(operator)
|
||||
] @string.special.symbol)
|
||||
|
||||
; ------
|
||||
; Macros
|
||||
; ------
|
||||
|
||||
(macro_definition
|
||||
name: (identifier) @function.macro)
|
||||
|
||||
(macro_identifier
|
||||
"@" @function.macro
|
||||
(identifier) @function.macro)
|
||||
|
||||
; -------------------
|
||||
; Modules and Imports
|
||||
@ -50,49 +59,6 @@
|
||||
(scoped_identifier
|
||||
(identifier) @namespace)
|
||||
|
||||
; -----
|
||||
; Types
|
||||
; -----
|
||||
|
||||
(abstract_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(primitive_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(struct_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(struct_definition
|
||||
. (_)
|
||||
(identifier) @variable.other.member)
|
||||
|
||||
(struct_definition
|
||||
. (_)
|
||||
(typed_expression
|
||||
. (identifier) @variable.other.member))
|
||||
|
||||
(type_parameter_list
|
||||
(identifier) @type)
|
||||
|
||||
(constrained_type_parameter
|
||||
(identifier) @type)
|
||||
|
||||
(subtype_clause
|
||||
(identifier) @type)
|
||||
|
||||
(typed_expression
|
||||
(identifier) @type . )
|
||||
|
||||
(parameterized_identifier
|
||||
(identifier) @type)
|
||||
|
||||
(type_argument_list
|
||||
(identifier) @type)
|
||||
|
||||
(where_clause
|
||||
(identifier) @type)
|
||||
|
||||
; -------------------
|
||||
; Function definition
|
||||
; -------------------
|
||||
@ -119,22 +85,6 @@
|
||||
; prevent constructors (PascalCase) to be highlighted as functions
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
(parameter_list
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(typed_parameter
|
||||
(identifier) @variable.parameter
|
||||
(identifier)? @type)
|
||||
|
||||
(optional_parameter
|
||||
. (identifier) @variable.parameter)
|
||||
|
||||
(slurp_parameter
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(function_expression
|
||||
. (identifier) @variable.parameter)
|
||||
|
||||
; ---------------
|
||||
; Functions calls
|
||||
; ---------------
|
||||
@ -145,93 +95,294 @@
|
||||
; prevent constructors (PascalCase) to be highlighted as functions
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
(
|
||||
(broadcast_call_expression
|
||||
(identifier) @function)
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
(
|
||||
(call_expression
|
||||
(field_expression (identifier) @function .))
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
(
|
||||
(broadcast_call_expression
|
||||
(identifier) @function)
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
(
|
||||
(broadcast_call_expression
|
||||
(field_expression (identifier) @function .))
|
||||
(#match? @function "^[^A-Z]"))
|
||||
|
||||
; ------
|
||||
; Macros
|
||||
; ------
|
||||
|
||||
(macro_definition
|
||||
name: (identifier) @function.macro)
|
||||
; -------------------
|
||||
; Functions builtins
|
||||
; -------------------
|
||||
|
||||
((identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"_abstracttype" "_apply_iterate" "_apply_pure" "_call_in_world" "_call_in_world_total"
|
||||
"_call_latest" "_equiv_typedef" "_expr" "_primitivetype" "_setsuper!" "_structtype" "_typebody!"
|
||||
"_typevar" "applicable" "apply_type" "arrayref" "arrayset" "arraysize" "const_arrayref"
|
||||
"donotdelete" "fieldtype" "get_binding_type" "getfield" "ifelse" "invoke" "isa" "isdefined"
|
||||
"modifyfield!" "nfields" "replacefield!" "set_binding_type!" "setfield!" "sizeof" "svec"
|
||||
"swapfield!" "throw" "tuple" "typeassert" "typeof"))
|
||||
|
||||
; -----------
|
||||
; Parameters
|
||||
; -----------
|
||||
|
||||
(parameter_list
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(optional_parameter
|
||||
. (identifier) @variable.parameter)
|
||||
|
||||
(slurp_parameter
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(typed_parameter
|
||||
parameter: (identifier)? @variable.parameter
|
||||
type: (_) @type)
|
||||
|
||||
(function_expression
|
||||
. (identifier) @variable.parameter) ; Single parameter arrow functions
|
||||
|
||||
; -----
|
||||
; Types
|
||||
; -----
|
||||
|
||||
; Definitions
|
||||
(abstract_definition
|
||||
name: (identifier) @type.definition) @keyword
|
||||
|
||||
(primitive_definition
|
||||
name: (identifier) @type.definition) @keyword
|
||||
|
||||
(struct_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(struct_definition
|
||||
. (_)
|
||||
(identifier) @variable.other.member)
|
||||
|
||||
(struct_definition
|
||||
. (_)
|
||||
(typed_expression
|
||||
. (identifier) @variable.other.member))
|
||||
|
||||
(type_clause
|
||||
[
|
||||
(identifier) @type
|
||||
(field_expression
|
||||
(identifier) @type .)
|
||||
])
|
||||
|
||||
; Annotations
|
||||
(parametrized_type_expression
|
||||
(_) @type
|
||||
(curly_expression
|
||||
(_) @type))
|
||||
|
||||
(type_parameter_list
|
||||
(identifier) @type)
|
||||
|
||||
(typed_expression
|
||||
(identifier) @type . )
|
||||
|
||||
(function_definition
|
||||
return_type: (identifier) @type)
|
||||
|
||||
(short_function_definition
|
||||
return_type: (identifier) @type)
|
||||
|
||||
(where_clause
|
||||
(identifier) @type)
|
||||
|
||||
(where_clause
|
||||
(curly_expression
|
||||
(_) @type))
|
||||
|
||||
; ---------
|
||||
; Builtins
|
||||
; ---------
|
||||
|
||||
; This list was generated with:
|
||||
;
|
||||
; istype(x) = typeof(x) === DataType || typeof(x) === UnionAll
|
||||
; get_types(m) = filter(x -> istype(Base.eval(m, x)), names(m))
|
||||
; type_names = sort(union(get_types(Core), get_types(Base)))
|
||||
;
|
||||
((identifier) @type.builtin
|
||||
(#any-of? @type.builtin
|
||||
"AbstractArray" "AbstractChannel" "AbstractChar" "AbstractDict" "AbstractDisplay"
|
||||
"AbstractFloat" "AbstractIrrational" "AbstractLock" "AbstractMatch" "AbstractMatrix"
|
||||
"AbstractPattern" "AbstractRange" "AbstractSet" "AbstractSlices" "AbstractString"
|
||||
"AbstractUnitRange" "AbstractVecOrMat" "AbstractVector" "Any" "ArgumentError" "Array"
|
||||
"AssertionError" "Atomic" "BigFloat" "BigInt" "BitArray" "BitMatrix" "BitSet" "BitVector" "Bool"
|
||||
"BoundsError" "By" "CanonicalIndexError" "CapturedException" "CartesianIndex" "CartesianIndices"
|
||||
"Cchar" "Cdouble" "Cfloat" "Channel" "Char" "Cint" "Cintmax_t" "Clong" "Clonglong" "Cmd" "Colon"
|
||||
"ColumnSlices" "Complex" "ComplexF16" "ComplexF32" "ComplexF64" "ComposedFunction"
|
||||
"CompositeException" "ConcurrencyViolationError" "Condition" "Cptrdiff_t" "Cshort" "Csize_t"
|
||||
"Cssize_t" "Cstring" "Cuchar" "Cuint" "Cuintmax_t" "Culong" "Culonglong" "Cushort" "Cvoid"
|
||||
"Cwchar_t" "Cwstring" "DataType" "DenseArray" "DenseMatrix" "DenseVecOrMat" "DenseVector" "Dict"
|
||||
"DimensionMismatch" "Dims" "DivideError" "DomainError" "EOFError" "Enum" "ErrorException"
|
||||
"Exception" "ExponentialBackOff" "Expr" "Float16" "Float32" "Float64" "Function" "GlobalRef"
|
||||
"HTML" "IO" "IOBuffer" "IOContext" "IOStream" "IdDict" "IndexCartesian" "IndexLinear"
|
||||
"IndexStyle" "InexactError" "InitError" "Int" "Int128" "Int16" "Int32" "Int64" "Int8" "Integer"
|
||||
"InterruptException" "InvalidStateException" "Irrational" "KeyError" "LazyString" "LinRange"
|
||||
"LineNumberNode" "LinearIndices" "LoadError" "Lt" "MIME" "Matrix" "Method" "MethodError"
|
||||
"Missing" "MissingException" "Module" "NTuple" "NamedTuple" "Nothing" "Number" "Ordering"
|
||||
"OrdinalRange" "OutOfMemoryError" "OverflowError" "Pair" "ParseError" "PartialQuickSort" "Perm"
|
||||
"PermutedDimsArray" "Pipe" "ProcessFailedException" "Ptr" "QuoteNode" "Rational" "RawFD"
|
||||
"ReadOnlyMemoryError" "Real" "ReentrantLock" "Ref" "Regex" "RegexMatch" "Returns"
|
||||
"ReverseOrdering" "RoundingMode" "RowSlices" "SegmentationFault" "Set" "Signed" "Slices" "Some"
|
||||
"SpinLock" "StackFrame" "StackOverflowError" "StackTrace" "Stateful" "StepRange" "StepRangeLen"
|
||||
"StridedArray" "StridedMatrix" "StridedVecOrMat" "StridedVector" "String" "StringIndexError"
|
||||
"SubArray" "SubString" "SubstitutionString" "Symbol" "SystemError" "Task" "TaskFailedException"
|
||||
"Text" "TextDisplay" "Timer" "Tmstruct" "Tuple" "Type" "TypeError" "TypeVar" "UInt" "UInt128"
|
||||
"UInt16" "UInt32" "UInt64" "UInt8" "UndefInitializer" "UndefKeywordError" "UndefRefError"
|
||||
"UndefVarError" "Union" "UnionAll" "UnitRange" "Unsigned" "Val" "VecElement" "VecOrMat" "Vector"
|
||||
"VersionNumber" "WeakKeyDict" "WeakRef"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin "begin" "end")
|
||||
(#has-ancestor? @variable.builtin index_expression))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin "begin" "end")
|
||||
(#has-ancestor? @variable.builtin range_expression))
|
||||
|
||||
(macro_identifier
|
||||
"@" @function.macro
|
||||
(identifier) @function.macro)
|
||||
|
||||
; --------
|
||||
; Keywords
|
||||
; --------
|
||||
|
||||
(function_definition
|
||||
["function" "end"] @keyword.function)
|
||||
[
|
||||
"global"
|
||||
"local"
|
||||
] @keyword
|
||||
|
||||
(compound_statement
|
||||
[
|
||||
"begin"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(quote_statement
|
||||
[
|
||||
"quote"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(let_statement
|
||||
[
|
||||
"let"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(if_statement
|
||||
["if" "end"] @keyword.control.conditional)
|
||||
(elseif_clause
|
||||
["elseif"] @keyword.control.conditional)
|
||||
(else_clause
|
||||
["else"] @keyword.control.conditional)
|
||||
(ternary_expression
|
||||
["?" ":"] @keyword.control.conditional)
|
||||
[
|
||||
"if"
|
||||
"end"
|
||||
] @keyword.control.conditional)
|
||||
|
||||
(for_statement
|
||||
["for" "end"] @keyword.control.repeat)
|
||||
(while_statement
|
||||
["while" "end"] @keyword.control.repeat)
|
||||
(break_statement) @keyword.control.repeat
|
||||
(continue_statement) @keyword.control.repeat
|
||||
(for_binding
|
||||
"in" @keyword.control.repeat)
|
||||
(for_clause
|
||||
"for" @keyword.control.repeat)
|
||||
(elseif_clause
|
||||
"elseif" @keyword.control.conditional)
|
||||
|
||||
(else_clause
|
||||
"else" @keyword.control.conditional)
|
||||
|
||||
(if_clause
|
||||
"if" @keyword.control.conditional) ; `if` clause in comprehensions
|
||||
|
||||
(ternary_expression
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.control.conditional)
|
||||
|
||||
(try_statement
|
||||
["try" "end" ] @keyword.control.exception)
|
||||
[
|
||||
"try"
|
||||
"end"
|
||||
] @keyword.control.exception)
|
||||
|
||||
(finally_clause
|
||||
"finally" @keyword.control.exception)
|
||||
|
||||
(catch_clause
|
||||
"catch" @keyword.control.exception)
|
||||
|
||||
(for_statement
|
||||
[
|
||||
"for"
|
||||
"end"
|
||||
] @keyword.control.repeat)
|
||||
|
||||
(while_statement
|
||||
[
|
||||
"while"
|
||||
"end"
|
||||
] @keyword.control.repeat)
|
||||
|
||||
(for_clause
|
||||
"for" @keyword.control.repeat)
|
||||
|
||||
[
|
||||
(break_statement)
|
||||
(continue_statement)
|
||||
] @keyword.control.repeat
|
||||
|
||||
(module_definition
|
||||
[
|
||||
"module"
|
||||
"baremodule"
|
||||
"end"
|
||||
] @keyword.control.import)
|
||||
|
||||
(import_statement
|
||||
[
|
||||
"export"
|
||||
"import"
|
||||
"using"
|
||||
] @keyword.control.import
|
||||
] @keyword.control.import)
|
||||
|
||||
(import_alias
|
||||
"as" @keyword.control.import)
|
||||
|
||||
(export_statement
|
||||
"export" @keyword.control.import)
|
||||
|
||||
(selected_import
|
||||
":" @punctuation.delimiter)
|
||||
|
||||
(struct_definition
|
||||
[
|
||||
"struct"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(macro_definition
|
||||
[
|
||||
"macro"
|
||||
"end"
|
||||
] @keyword)
|
||||
|
||||
(function_definition
|
||||
[
|
||||
"function"
|
||||
"end"
|
||||
] @keyword.function)
|
||||
|
||||
(do_clause
|
||||
[
|
||||
"abstract"
|
||||
"baremodule"
|
||||
"begin"
|
||||
"const"
|
||||
"do"
|
||||
"end"
|
||||
"let"
|
||||
"macro"
|
||||
"module"
|
||||
"mutable"
|
||||
"primitive"
|
||||
"quote"
|
||||
"return"
|
||||
"struct"
|
||||
"type"
|
||||
"where"
|
||||
] @keyword
|
||||
] @keyword.function)
|
||||
|
||||
; TODO: fix this
|
||||
((identifier) @keyword (#match? @keyword "global|local"))
|
||||
(return_statement
|
||||
"return" @keyword.control.return)
|
||||
|
||||
[
|
||||
"const"
|
||||
"mutable"
|
||||
] @keyword.storage.modifier
|
||||
|
||||
; ---------
|
||||
; Operators
|
||||
@ -239,14 +390,34 @@
|
||||
|
||||
[
|
||||
(operator)
|
||||
"::"
|
||||
"<:"
|
||||
":"
|
||||
"=>"
|
||||
"..."
|
||||
"$"
|
||||
"="
|
||||
"∈"
|
||||
] @operator
|
||||
|
||||
(adjoint_expression
|
||||
"'" @operator)
|
||||
|
||||
(range_expression
|
||||
":" @operator)
|
||||
|
||||
((operator) @keyword.operator
|
||||
(#any-of? @keyword.operator "in" "isa"))
|
||||
|
||||
(for_binding
|
||||
"in" @keyword.operator)
|
||||
|
||||
(where_clause
|
||||
"where" @keyword.operator)
|
||||
|
||||
(where_expression
|
||||
"where" @keyword.operator)
|
||||
|
||||
(binary_expression
|
||||
(_)
|
||||
(operator) @operator
|
||||
(identifier) @function
|
||||
(#any-of? @operator "|>" ".|>"))
|
||||
|
||||
; ------------
|
||||
; Punctuations
|
||||
; ------------
|
||||
@ -255,40 +426,58 @@
|
||||
"."
|
||||
","
|
||||
";"
|
||||
"::"
|
||||
"->"
|
||||
] @punctuation.delimiter
|
||||
|
||||
"..." @punctuation.special
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
; ---------------------
|
||||
; Remaining identifiers
|
||||
; ---------------------
|
||||
; ---------
|
||||
; Literals
|
||||
; ---------
|
||||
|
||||
(const_statement
|
||||
(variable_declaration
|
||||
. (identifier) @constant))
|
||||
(boolean_literal) @constant.builtin.boolean
|
||||
|
||||
(integer_literal) @constant.numeric.integer
|
||||
|
||||
(float_literal) @constant.numeric.float
|
||||
|
||||
; SCREAMING_SNAKE_CASE
|
||||
(
|
||||
(identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z0-9_]*$"))
|
||||
((identifier) @constant.numeric.float)
|
||||
(#match? @constant.numeric.float "^((Inf|NaN)(16|32|64)?)$"))
|
||||
|
||||
; remaining identifiers that start with capital letters should be types (PascalCase)
|
||||
(
|
||||
(identifier) @type
|
||||
(#match? @type "^[A-Z]"))
|
||||
((identifier) @constant.builtin)
|
||||
(#match? @constant.builtin "^(nothing|missing|undef)$"))
|
||||
|
||||
; Field expressions are either module content or struct fields.
|
||||
; Module types and constants should already be captured, so this
|
||||
; assumes the remaining identifiers to be struct fields.
|
||||
(field_expression
|
||||
(_)
|
||||
(identifier) @variable.other.member)
|
||||
(character_literal) @constant.character
|
||||
|
||||
(identifier) @variable
|
||||
(escape_sequence) @constant.character.escape
|
||||
|
||||
(string_literal) @string
|
||||
|
||||
(prefixed_string_literal
|
||||
prefix: (identifier) @function.macro) @string
|
||||
|
||||
(command_literal) @string
|
||||
|
||||
(prefixed_command_literal
|
||||
prefix: (identifier) @function.macro) @string
|
||||
|
||||
; ---------
|
||||
; Comments
|
||||
; ---------
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @comment
|
||||
|
@ -2,15 +2,39 @@
|
||||
(struct_definition)
|
||||
(macro_definition)
|
||||
(function_definition)
|
||||
(compound_expression)
|
||||
(let_statement)
|
||||
(compound_statement)
|
||||
(if_statement)
|
||||
(try_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(let_statement)
|
||||
(quote_statement)
|
||||
(do_clause)
|
||||
(parameter_list)
|
||||
(assignment)
|
||||
(for_binding)
|
||||
(call_expression)
|
||||
(parenthesized_expression)
|
||||
(tuple_expression)
|
||||
(comprehension_expression)
|
||||
(matrix_expression)
|
||||
(vector_expression)
|
||||
] @indent
|
||||
|
||||
[
|
||||
"end"
|
||||
")"
|
||||
"]"
|
||||
"}"
|
||||
] @outdent
|
||||
|
||||
(argument_list
|
||||
. (_) @anchor
|
||||
(#set! "scope" "tail")) @align
|
||||
|
||||
(parameter_list
|
||||
. (_) @anchor
|
||||
(#set! "scope" "tail")) @align
|
||||
|
||||
(curly_expression
|
||||
. (_) @anchor
|
||||
(#set! "scope" "tail")) @align
|
||||
|
@ -9,7 +9,8 @@
|
||||
(primitive_definition)
|
||||
(abstract_definition)
|
||||
(struct_definition)
|
||||
(assignment_expression)
|
||||
(short_function_definition)
|
||||
(assignment)
|
||||
(const_statement)
|
||||
])
|
||||
(#set! injection.language "markdown"))
|
||||
@ -21,10 +22,17 @@
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
(
|
||||
[
|
||||
(command_literal)
|
||||
(prefixed_command_literal)
|
||||
] @injection.content
|
||||
(#set! injection.language "sh"))
|
||||
|
||||
(
|
||||
(prefixed_string_literal
|
||||
prefix: (identifier) @function.macro) @injection.content
|
||||
(#eq? @function.macro "re")
|
||||
(#eq? @function.macro "r")
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
(
|
||||
|
@ -2,43 +2,100 @@
|
||||
; Definitions
|
||||
; -----------
|
||||
|
||||
; Imports
|
||||
(import_statement
|
||||
; Variables
|
||||
(assignment
|
||||
(identifier) @local.definition)
|
||||
|
||||
(assignment
|
||||
(tuple_expression
|
||||
(identifier) @local.definition))
|
||||
|
||||
; Constants
|
||||
(const_statement
|
||||
(variable_declaration
|
||||
(assignment
|
||||
. (identifier) @local.definition))
|
||||
|
||||
; let/const bindings
|
||||
(let_binding
|
||||
(identifier) @local.definition)
|
||||
|
||||
(let_binding
|
||||
(tuple_expression
|
||||
(identifier) @local.definition))
|
||||
|
||||
; For bindings
|
||||
(for_binding
|
||||
(identifier) @local.definition)
|
||||
|
||||
(for_binding
|
||||
(tuple_expression
|
||||
(identifier) @local.definition))
|
||||
|
||||
; Types
|
||||
(struct_definition
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(abstract_definition
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(abstract_definition
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(type_parameter_list
|
||||
(identifier) @local.definition)
|
||||
|
||||
; Module imports
|
||||
(import_statement
|
||||
(identifier) @local.definition)
|
||||
|
||||
; Parameters
|
||||
(parameter_list
|
||||
(identifier) @local.definition)
|
||||
|
||||
(typed_parameter
|
||||
. (identifier) @local.definition)
|
||||
|
||||
(optional_parameter .
|
||||
(optional_parameter
|
||||
.
|
||||
(identifier) @local.definition)
|
||||
|
||||
(slurp_parameter
|
||||
(identifier) @local.definition)
|
||||
|
||||
(typed_parameter
|
||||
parameter: (identifier) @local.definition
|
||||
(_))
|
||||
|
||||
; Single parameter arrow function
|
||||
(function_expression
|
||||
. (identifier) @local.definition)
|
||||
.
|
||||
(identifier) @local.definition)
|
||||
|
||||
; ------
|
||||
; Scopes
|
||||
; ------
|
||||
; Function/macro definitions
|
||||
(function_definition
|
||||
name: (identifier) @local.definition) @local.scope
|
||||
|
||||
[
|
||||
(function_definition)
|
||||
(short_function_definition)
|
||||
(macro_definition)
|
||||
] @local.scope
|
||||
(short_function_definition
|
||||
name: (identifier) @local.definition) @local.scope
|
||||
|
||||
(macro_definition
|
||||
name: (identifier) @local.definition) @local.scope
|
||||
|
||||
; ----------
|
||||
; References
|
||||
; ----------
|
||||
|
||||
(identifier) @local.reference
|
||||
|
||||
; ------
|
||||
; Scopes
|
||||
; ------
|
||||
|
||||
[
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(try_statement)
|
||||
(catch_clause)
|
||||
(finally_clause)
|
||||
(let_statement)
|
||||
(quote_statement)
|
||||
(do_clause)
|
||||
] @local.scope
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
; Identifiers
|
||||
|
||||
[(NAME) (SYMBOLNAME)] @variable
|
||||
|
||||
(section
|
||||
.
|
||||
(NAME) @namespace)
|
||||
|
||||
[(NAME) (SYMBOLNAME)] @variable
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
|
@ -75,11 +75,16 @@
|
||||
"pre-instr-symbol"
|
||||
"post-instr-symbol"
|
||||
"heap-alloc-marker"
|
||||
"pcsections"
|
||||
"mmra"
|
||||
"cfi-type"
|
||||
"debug-instr-number"
|
||||
"debug-location"
|
||||
"dbg-instr-ref"
|
||||
"mcsymbol"
|
||||
"tied-def"
|
||||
"target-flags"
|
||||
"vscale"
|
||||
"CustomRegMask"
|
||||
"same_value"
|
||||
"def_cfa_register"
|
||||
@ -118,11 +123,16 @@
|
||||
"got"
|
||||
"jump-table"
|
||||
"syncscope"
|
||||
"address-taken"
|
||||
"machine-block-address-taken"
|
||||
"ir-block-address-taken"
|
||||
"landing-pad"
|
||||
"inlineasm-br-indirect-target"
|
||||
"ehfunclet-entry"
|
||||
"bb_id"
|
||||
"call-frame-size"
|
||||
"bbsections"
|
||||
"Exception"
|
||||
"Cold"
|
||||
|
||||
(intpred)
|
||||
(floatpred)
|
||||
|
@ -17,9 +17,11 @@
|
||||
|
||||
[
|
||||
"to"
|
||||
"nneg"
|
||||
"nuw"
|
||||
"nsw"
|
||||
"exact"
|
||||
"disjoint"
|
||||
"unwind"
|
||||
"from"
|
||||
"cleanup"
|
||||
|
@ -23,12 +23,16 @@
|
||||
(borrow_expression "&" @keyword.storage.modifier.ref)
|
||||
(borrow_expression "&mut" @keyword.storage.modifier.mut)
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(constant_identifier) @constant
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
(function_identifier) @function
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
(struct_identifier) @type
|
||||
(pack_expression
|
||||
access: (module_access
|
||||
@ -152,6 +156,3 @@
|
||||
"with"
|
||||
] @keyword
|
||||
|
||||
(primitive_type) @type.buildin
|
||||
|
||||
(identifier) @variable
|
||||
|
1
runtime/queries/nestedtext/highlights.scm
Normal file
1
runtime/queries/nestedtext/highlights.scm
Normal file
@ -0,0 +1 @@
|
||||
; inherits: yaml
|
1
runtime/queries/nestedtext/indents.scm
Normal file
1
runtime/queries/nestedtext/indents.scm
Normal file
@ -0,0 +1 @@
|
||||
; inherits: yaml
|
1
runtime/queries/nestedtext/injections.scm
Normal file
1
runtime/queries/nestedtext/injections.scm
Normal file
@ -0,0 +1 @@
|
||||
; inherits: yaml
|
1
runtime/queries/nestedtext/textobjects.scm
Normal file
1
runtime/queries/nestedtext/textobjects.scm
Normal file
@ -0,0 +1 @@
|
||||
; inherits: yaml
|
@ -17,6 +17,18 @@
|
||||
"with"
|
||||
] @keyword
|
||||
|
||||
(variable_expression name: (identifier) @variable)
|
||||
|
||||
(select_expression
|
||||
attrpath: (attrpath attr: (identifier)) @variable.other.member)
|
||||
|
||||
(apply_expression
|
||||
function: [
|
||||
(variable_expression name: (identifier) @function)
|
||||
(select_expression
|
||||
attrpath: (attrpath
|
||||
attr: (identifier) @function .))])
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#match? @variable.builtin "^(__currentSystem|__currentTime|__nixPath|__nixVersion|__storeDir|builtins)$")
|
||||
(#is-not? local))
|
||||
@ -59,28 +71,16 @@
|
||||
name: (identifier) @variable.parameter
|
||||
"?"? @punctuation.delimiter)
|
||||
|
||||
(select_expression
|
||||
attrpath: (attrpath attr: (identifier)) @variable.other.member)
|
||||
|
||||
(interpolation
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @embedded
|
||||
|
||||
(apply_expression
|
||||
function: [
|
||||
(variable_expression name: (identifier) @function)
|
||||
(select_expression
|
||||
attrpath: (attrpath
|
||||
attr: (identifier) @function .))])
|
||||
|
||||
(unary_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(binary_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(variable_expression name: (identifier) @variable)
|
||||
|
||||
(binding
|
||||
attrpath: (attrpath attr: (identifier)) @variable.other.member)
|
||||
|
||||
|
@ -127,6 +127,16 @@
|
||||
(#set! injection.language "haskell")
|
||||
(#set! injection.combined))
|
||||
|
||||
; pkgs.writers.writeNim[Bin] name attrs content
|
||||
(apply_expression
|
||||
(apply_expression
|
||||
function: (apply_expression
|
||||
function: ((_) @_func)))
|
||||
argument: (indented_string_expression (string_fragment) @injection.content)
|
||||
(#match? @_func "(^|\\.)writeNim(Bin)?$")
|
||||
(#set! injection.language "nim")
|
||||
(#set! injection.combined))
|
||||
|
||||
; pkgs.writers.writeJS[Bin] name attrs content
|
||||
(apply_expression
|
||||
(apply_expression
|
||||
|
@ -3,13 +3,14 @@
|
||||
(boolean) @constant.builtin.boolean
|
||||
(include_path) @string.special.path
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(parameters_declaration (identifier) @variable.parameter)
|
||||
(function_declaration name: (identifier) @function)
|
||||
|
||||
(function_call function: (identifier) @function)
|
||||
(module_call name: (identifier) @function)
|
||||
|
||||
(identifier) @variable
|
||||
(special_variable) @variable.builtin
|
||||
|
||||
[
|
||||
|
@ -1,9 +1,9 @@
|
||||
[
|
||||
"use" "no" "require" "package"
|
||||
"use" "no" "require" "package" "class" "role"
|
||||
] @keyword.control.import
|
||||
|
||||
[
|
||||
"sub"
|
||||
"sub" "method" "async" "extended"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
@ -17,7 +17,7 @@
|
||||
] @keyword.control.repeat
|
||||
|
||||
[
|
||||
"my" "our" "local"
|
||||
"my" "our" "local" "state"
|
||||
] @keyword.storage.modifier
|
||||
|
||||
[
|
||||
@ -29,9 +29,10 @@
|
||||
] @constant.builtin
|
||||
|
||||
(phaser_statement phase: _ @keyword.directive)
|
||||
(class_phaser_statement phase: _ @keyword.directive)
|
||||
|
||||
[
|
||||
"or" "and"
|
||||
"or" "xor" "and"
|
||||
"eq" "ne" "cmp" "lt" "le" "ge" "gt"
|
||||
"isa"
|
||||
] @keyword.operator
|
||||
@ -55,7 +56,7 @@
|
||||
|
||||
[(quoted_regexp) (match_regexp)] @string.regexp
|
||||
|
||||
(autoquoted_bareword _?) @string.special
|
||||
(autoquoted_bareword) @string.special
|
||||
|
||||
[(scalar) (arraylen)] @variable
|
||||
(scalar_deref_expression ["->" "$" "*"] @variable)
|
||||
|
@ -1,19 +1,3 @@
|
||||
; ----------------------------------------------------------------------------
|
||||
; Record fields would need to come before literal strings in order to be captured correctly
|
||||
|
||||
(record_accessor
|
||||
field: [ (variable)
|
||||
(string)
|
||||
(triple_quote_string)
|
||||
] @variable.other.member)
|
||||
|
||||
(exp_record_access
|
||||
field: [ (variable)
|
||||
(string)
|
||||
(triple_quote_string)
|
||||
] @variable.other.member)
|
||||
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Literals and comments
|
||||
|
||||
@ -21,6 +5,7 @@
|
||||
(exp_negation) @constant.numeric.integer
|
||||
(exp_literal (number)) @constant.numeric.float
|
||||
(char) @constant.character
|
||||
|
||||
[
|
||||
(string)
|
||||
(triple_quote_string)
|
||||
@ -28,7 +13,6 @@
|
||||
|
||||
(comment) @comment
|
||||
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Punctuation
|
||||
|
||||
@ -41,18 +25,19 @@
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
(comma)
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
(comma) @punctuation.delimiter
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Types
|
||||
|
||||
(type) @type
|
||||
|
||||
(constructor) @constructor
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Keywords, operators, includes
|
||||
|
||||
; This needs to come before the other "else" in
|
||||
; order to be highlighted correctly
|
||||
(class_instance "else" @keyword)
|
||||
(module) @namespace
|
||||
|
||||
[
|
||||
"if"
|
||||
@ -95,7 +80,6 @@
|
||||
] @operator
|
||||
|
||||
(qualified_module (module) @constructor)
|
||||
(module) @namespace
|
||||
(qualified_type (module) @namespace)
|
||||
(qualified_variable (module) @namespace)
|
||||
(import (module) @namespace)
|
||||
@ -122,6 +106,11 @@
|
||||
"infixr"
|
||||
] @keyword
|
||||
|
||||
; NOTE
|
||||
; Needs to come after the other `else` in
|
||||
; order to be highlighted correctly
|
||||
(class_instance "else" @keyword)
|
||||
|
||||
(type_role_declaration
|
||||
"role" @keyword
|
||||
role: (type_role) @keyword)
|
||||
@ -131,10 +120,27 @@
|
||||
; ----------------------------------------------------------------------------
|
||||
; Functions and variables
|
||||
|
||||
(variable) @variable
|
||||
|
||||
(row_field (field_name) @variable.other.member)
|
||||
(record_field (field_name) @variable.other.member)
|
||||
(record_field (field_pun) @variable.other.member)
|
||||
|
||||
; NOTE
|
||||
; Record fields must come after literal strings and
|
||||
; plain variables in order to be highlighted correctly
|
||||
(record_accessor
|
||||
field: [ (variable)
|
||||
(string)
|
||||
(triple_quote_string)
|
||||
] @variable.other.member)
|
||||
|
||||
(exp_record_access
|
||||
field: [ (variable)
|
||||
(string)
|
||||
(triple_quote_string)
|
||||
] @variable.other.member)
|
||||
|
||||
(signature name: (variable) @type)
|
||||
(function name: (variable) @function)
|
||||
(class_instance (instance_name) @function)
|
||||
@ -151,14 +157,5 @@
|
||||
(exp_ticked (exp_name (variable) @operator))
|
||||
(exp_ticked (exp_name (qualified_variable (variable) @operator)))
|
||||
|
||||
(variable) @variable
|
||||
|
||||
("@" @namespace) ; "as" pattern operator, e.g. x@Constructor
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Types
|
||||
|
||||
(type) @type
|
||||
|
||||
(constructor) @constructor
|
||||
(patterns (pat_as "@" @namespace))
|
||||
|
||||
|
94
runtime/queries/quint/highlights.scm
Normal file
94
runtime/queries/quint/highlights.scm
Normal file
@ -0,0 +1,94 @@
|
||||
[
|
||||
"module"
|
||||
"type"
|
||||
"assume"
|
||||
"const"
|
||||
"var"
|
||||
"val"
|
||||
"nondet"
|
||||
"def"
|
||||
"pure"
|
||||
"action"
|
||||
"temporal"
|
||||
"run"
|
||||
] @keyword
|
||||
|
||||
(match_expr "match" @keyword.control.conditional)
|
||||
|
||||
(if_else_condition
|
||||
"if" @keyword.control.conditional
|
||||
"else" @keyword.control.conditional)
|
||||
|
||||
(import "import" @keyword.control.import)
|
||||
(import "as" @keyword.control.import)
|
||||
(import "from" @keyword.control.import)
|
||||
(export "export" @keyword.control.import)
|
||||
(export "as" @keyword.control.import)
|
||||
|
||||
[
|
||||
"true"
|
||||
"false"
|
||||
"Int"
|
||||
"Nat"
|
||||
"Bool"
|
||||
] @constant.builtin
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"-"
|
||||
"+"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"<"
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
"!="
|
||||
"=>"
|
||||
">"
|
||||
">="
|
||||
"^"
|
||||
"->"
|
||||
] @operator
|
||||
|
||||
(infix_and "and" @operator)
|
||||
(infix_or "or" @operator)
|
||||
(infix_iff "iff" @operator)
|
||||
(infix_implies "implies" @operator)
|
||||
|
||||
(braced_and "and" @keyword)
|
||||
(braced_or "or" @keyword)
|
||||
(braced_all "all" @keyword)
|
||||
(braced_any "any" @keyword)
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
(polymorphic_type
|
||||
(type) @type.parameter)
|
||||
|
||||
(variant_constructor) @type.enum.variant
|
||||
|
||||
(type) @type
|
||||
(int_literal) @constant.numeric.integer
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
|
||||
(operator_application
|
||||
operator: (qualified_identifier) @function)
|
||||
|
||||
(operator_definition
|
||||
name: (qualified_identifier) @function
|
||||
arguments: (typed_argument_list))
|
@ -10,11 +10,10 @@
|
||||
[
|
||||
(type_identifier)
|
||||
(unit_type)
|
||||
(list)
|
||||
(list_pattern)
|
||||
] @type
|
||||
|
||||
(list ["list{" "}"] @type)
|
||||
(list_pattern ["list{" "}"] @type)
|
||||
|
||||
[
|
||||
(variant_identifier)
|
||||
(polyvar_identifier)
|
||||
@ -72,14 +71,16 @@
|
||||
; single parameter with no parens
|
||||
(function parameter: (value_identifier) @variable.parameter)
|
||||
|
||||
; first-level descructuring (required for nvim-tree-sitter as it only matches direct
|
||||
; children and the above patterns do not match destructuring patterns in NeoVim)
|
||||
(parameter (tuple_pattern (tuple_item_pattern (value_identifier) @variable.parameter)))
|
||||
(parameter (array_pattern (value_identifier) @variable.parameter))
|
||||
(parameter (record_pattern (value_identifier) @variable.parameter))
|
||||
|
||||
; Meta
|
||||
;-----
|
||||
|
||||
[
|
||||
"@"
|
||||
"@@"
|
||||
(decorator_identifier)
|
||||
] @keyword.directive
|
||||
(decorator_identifier) @keyword.directive
|
||||
|
||||
(extension_identifier) @keyword
|
||||
("%") @keyword
|
||||
@ -87,7 +88,7 @@
|
||||
; Misc
|
||||
;-----
|
||||
|
||||
; (subscript_expression index: (string) @attribute)
|
||||
(subscript_expression index: (string) @attribute)
|
||||
(polyvar_type_pattern "#" @constant)
|
||||
|
||||
[
|
||||
@ -101,18 +102,21 @@
|
||||
"external"
|
||||
"let"
|
||||
"module"
|
||||
"mutable"
|
||||
"private"
|
||||
"rec"
|
||||
"type"
|
||||
"and"
|
||||
"assert"
|
||||
"async"
|
||||
"await"
|
||||
"with"
|
||||
"unpack"
|
||||
] @keyword.storage.type
|
||||
"lazy"
|
||||
"constraint"
|
||||
] @keyword
|
||||
|
||||
"mutable" @keyword.storage.modifier
|
||||
((function "async" @keyword.storage))
|
||||
|
||||
(module_unpack "unpack" @keyword)
|
||||
|
||||
[
|
||||
"if"
|
||||
@ -169,6 +173,7 @@
|
||||
"->"
|
||||
"|>"
|
||||
":>"
|
||||
"+="
|
||||
(uncurry)
|
||||
] @operator
|
||||
|
||||
|
@ -1,8 +1,29 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
((comment) @injection.content (#set! injection.language "comment"))
|
||||
|
||||
((raw_js) @injection.content
|
||||
(#set! injection.language "javascript"))
|
||||
; %re
|
||||
(extension_expression
|
||||
(extension_identifier) @_name
|
||||
(#eq? @_name "re")
|
||||
(expression_statement (_) @injection.content (#set! injection.language "regex")))
|
||||
|
||||
; %raw
|
||||
(extension_expression
|
||||
(extension_identifier) @_name
|
||||
(#eq? @_name "raw")
|
||||
(expression_statement
|
||||
(_ (_) @injection.content (#set! injection.language "javascript"))))
|
||||
|
||||
; %graphql
|
||||
(extension_expression
|
||||
(extension_identifier) @_name
|
||||
(#eq? @_name "graphql")
|
||||
(expression_statement
|
||||
(_ (_) @injection.content (#set! injection.language "graphql"))))
|
||||
|
||||
; %relay
|
||||
(extension_expression
|
||||
(extension_identifier) @_name
|
||||
(#eq? @_name "relay")
|
||||
(expression_statement
|
||||
(_ (_) @injection.content (#set! injection.language "graphql") )))
|
||||
|
||||
((raw_gql) @injection.content
|
||||
(#set! injection.language "graphql"))
|
@ -1,7 +1,7 @@
|
||||
(switch_expression) @local.scope
|
||||
(if_expression) @local.scope
|
||||
|
||||
; Definitions
|
||||
;------------
|
||||
(type_declaration) @local.defintion
|
||||
(let_binding) @local.defintion
|
||||
(type_declaration) @local.definition
|
||||
(let_binding) @local.definition
|
||||
(module_declaration) @local.definition
|
||||
|
@ -1,7 +1,7 @@
|
||||
; Classes (modules)
|
||||
;------------------
|
||||
|
||||
(module_declaration definition: ((_) @class.inside)) @class.around
|
||||
(module_binding definition: ((_) @class.inside)) @class.around
|
||||
|
||||
; Blocks
|
||||
;-------
|
||||
|
@ -1,3 +1,11 @@
|
||||
; Structs
|
||||
;------------
|
||||
|
||||
(enum_variant) @type.enum.variant
|
||||
(struct_entry (_) @variable.other.member ":")
|
||||
(struct_name (identifier)) @type
|
||||
(unit_struct) @type.builtin
|
||||
|
||||
; Literals
|
||||
;------------
|
||||
|
||||
@ -7,16 +15,6 @@
|
||||
(float) @constant.numeric.float
|
||||
(char) @constant.character
|
||||
|
||||
; Structs
|
||||
;------------
|
||||
|
||||
(enum_variant) @type.enum.variant
|
||||
(struct_entry (_) @variable.other.member ":")
|
||||
(struct_name (identifier)) @type
|
||||
|
||||
|
||||
|
||||
|
||||
; Comments
|
||||
;------------
|
||||
|
||||
@ -37,6 +35,7 @@
|
||||
"{" @punctuation.bracket
|
||||
"}" @punctuation.bracket
|
||||
|
||||
"-" @operator
|
||||
|
||||
; Special
|
||||
;------------
|
||||
|
@ -10,32 +10,28 @@
|
||||
(block_comment) @comment.block
|
||||
(directive) @keyword.directive
|
||||
|
||||
; operators
|
||||
; variables
|
||||
|
||||
((symbol) @operator
|
||||
(#match? @operator "^(\\+|-|\\*|/|=|>|<|>=|<=)$"))
|
||||
((symbol) @variable.builtin
|
||||
(#eq? @variable.builtin "..."))
|
||||
|
||||
; keywords
|
||||
((symbol) @variable.builtin
|
||||
(#eq? @variable.builtin "."))
|
||||
|
||||
(symbol) @variable
|
||||
|
||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
|
||||
(quote "'") @operator
|
||||
(unquote_splicing ",@") @operator
|
||||
(unquote ",") @operator
|
||||
(quasiquote "`") @operator
|
||||
|
||||
; procedure
|
||||
|
||||
(list
|
||||
.
|
||||
((symbol) @keyword.conditional
|
||||
(#match? @keyword.conditional "^(if|cond|case|when|unless)$"
|
||||
)))
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @keyword
|
||||
(#match? @keyword
|
||||
"^(define-syntax|let\\*|lambda|λ|case|=>|quote-splicing|unquote-splicing|set!|let|letrec|letrec-syntax|let-values|let\\*-values|do|else|define|cond|syntax-rules|unquote|begin|quote|let-syntax|and|if|quasiquote|letrec|delay|or|when|unless|identifier-syntax|assert|library|export|import|rename|only|except|prefix)$"
|
||||
))
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @function.builtin
|
||||
(#match? @function.builtin
|
||||
"^(caar|cadr|call-with-input-file|call-with-output-file|cdar|cddr|list|open-input-file|open-output-file|with-input-from-file|with-output-to-file|\\*|\\+|-|/|<|<=|=|>|>=|abs|acos|angle|append|apply|asin|assoc|assq|assv|atan|boolean\\?|caaaar|caaadr|caaar|caadar|caaddr|caadr|cadaar|cadadr|cadar|caddar|cadddr|caddr|call-with-current-continuation|call-with-values|car|cdaaar|cdaadr|cdaar|cdadar|cdaddr|cdadr|cddaar|cddadr|cddar|cdddar|cddddr|cdddr|cdr|ceiling|char->integer|char-alphabetic\\?|char-ci<=\\?|char-ci<\\?|char-ci=\\?|char-ci>=\\?|char-ci>\\?|char-downcase|char-lower-case\\?|char-numeric\\?|char-ready\\?|char-upcase|char-upper-case\\?|char-whitespace\\?|char<=\\?|char<\\?|char=\\?|char>=\\?|char>\\?|char\\?|close-input-port|close-output-port|complex\\?|cons|cos|current-error-port|current-input-port|current-output-port|denominator|display|dynamic-wind|eof-object\\?|eq\\?|equal\\?|eqv\\?|eval|even\\?|exact->inexact|exact\\?|exp|expt|floor|flush-output|for-each|force|gcd|imag-part|inexact->exact|inexact\\?|input-port\\?|integer->char|integer\\?|interaction-environment|lcm|length|list->string|list->vector|list-ref|list-tail|list\\?|load|log|magnitude|make-polar|make-rectangular|make-string|make-vector|map|max|member|memq|memv|min|modulo|negative\\?|newline|not|null-environment|null\\?|number->string|number\\?|numerator|odd\\?|output-port\\?|pair\\?|peek-char|positive\\?|procedure\\?|quotient|rational\\?|rationalize|read|read-char|real-part|real\\?|remainder|reverse|round|scheme-report-environment|set-car!|set-cdr!|sin|sqrt|string|string->list|string->number|string->symbol|string-append|string-ci<=\\?|string-ci<\\?|string-ci=\\?|string-ci>=\\?|string-ci>\\?|string-copy|string-fill!|string-length|string-ref|string-set!|string<=\\?|string<\\?|string=\\?|string>=\\?|string>\\?|string\\?|substring|symbol->string|symbol\\?|tan|transcript-off|transcript-on|truncate|values|vector|vector->list|vector-fill!|vector-length|vector-ref|vector-set!|vector\\?|write|write-char|zero\\?)$"
|
||||
))
|
||||
(symbol) @function)
|
||||
|
||||
; special forms
|
||||
|
||||
@ -62,12 +58,10 @@
|
||||
(#match? @_f
|
||||
"^(let|let\\*|let-syntax|let-values|let\\*-values|letrec|letrec\\*|letrec-syntax)$"))
|
||||
|
||||
; quote
|
||||
; operators
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @_f
|
||||
(#eq? @_f "quote")) @string.symbol
|
||||
((symbol) @operator
|
||||
(#match? @operator "^(\\+|-|\\*|/|=|>|<|>=|<=)$"))
|
||||
|
||||
; library
|
||||
|
||||
@ -79,26 +73,31 @@
|
||||
|
||||
(#eq? @_lib "library"))
|
||||
|
||||
; procedure
|
||||
; quote
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @function)
|
||||
(symbol) @_f
|
||||
(#eq? @_f "quote")) @string.symbol
|
||||
|
||||
;; variables
|
||||
; keywords
|
||||
|
||||
((symbol) @variable.builtin
|
||||
(#eq? @variable.builtin "..."))
|
||||
(list
|
||||
.
|
||||
((symbol) @keyword.conditional
|
||||
(#match? @keyword.conditional "^(if|cond|case|when|unless)$"
|
||||
)))
|
||||
|
||||
((symbol) @variable.builtin
|
||||
(#eq? @variable.builtin "."))
|
||||
|
||||
(symbol) @variable
|
||||
|
||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
|
||||
(quote "'") @operator
|
||||
(unquote_splicing ",@") @operator
|
||||
(unquote ",") @operator
|
||||
(quasiquote "`") @operator
|
||||
(list
|
||||
.
|
||||
(symbol) @keyword
|
||||
(#match? @keyword
|
||||
"^(define-syntax|let\\*|lambda|λ|case|=>|quote-splicing|unquote-splicing|set!|let|letrec|letrec-syntax|let-values|let\\*-values|do|else|define|cond|syntax-rules|unquote|begin|quote|let-syntax|and|if|quasiquote|letrec|delay|or|when|unless|identifier-syntax|assert|library|export|import|rename|only|except|prefix)$"
|
||||
))
|
||||
|
||||
(list
|
||||
.
|
||||
(symbol) @function.builtin
|
||||
(#match? @function.builtin
|
||||
"^(caar|cadr|call-with-input-file|call-with-output-file|cdar|cddr|list|open-input-file|open-output-file|with-input-from-file|with-output-to-file|\\*|\\+|-|/|<|<=|=|>|>=|abs|acos|angle|append|apply|asin|assoc|assq|assv|atan|boolean\\?|caaaar|caaadr|caaar|caadar|caaddr|caadr|cadaar|cadadr|cadar|caddar|cadddr|caddr|call-with-current-continuation|call-with-values|car|cdaaar|cdaadr|cdaar|cdadar|cdaddr|cdadr|cddaar|cddadr|cddar|cdddar|cddddr|cdddr|cdr|ceiling|char->integer|char-alphabetic\\?|char-ci<=\\?|char-ci<\\?|char-ci=\\?|char-ci>=\\?|char-ci>\\?|char-downcase|char-lower-case\\?|char-numeric\\?|char-ready\\?|char-upcase|char-upper-case\\?|char-whitespace\\?|char<=\\?|char<\\?|char=\\?|char>=\\?|char>\\?|char\\?|close-input-port|close-output-port|complex\\?|cons|cos|current-error-port|current-input-port|current-output-port|denominator|display|dynamic-wind|eof-object\\?|eq\\?|equal\\?|eqv\\?|eval|even\\?|exact->inexact|exact\\?|exp|expt|floor|flush-output|for-each|force|gcd|imag-part|inexact->exact|inexact\\?|input-port\\?|integer->char|integer\\?|interaction-environment|lcm|length|list->string|list->vector|list-ref|list-tail|list\\?|load|log|magnitude|make-polar|make-rectangular|make-string|make-vector|map|max|member|memq|memv|min|modulo|negative\\?|newline|not|null-environment|null\\?|number->string|number\\?|numerator|odd\\?|output-port\\?|pair\\?|peek-char|positive\\?|procedure\\?|quotient|rational\\?|rationalize|read|read-char|real-part|real\\?|remainder|reverse|round|scheme-report-environment|set-car!|set-cdr!|sin|sqrt|string|string->list|string->number|string->symbol|string-append|string-ci<=\\?|string-ci<\\?|string-ci=\\?|string-ci>=\\?|string-ci>\\?|string-copy|string-fill!|string-length|string-ref|string-set!|string<=\\?|string<\\?|string=\\?|string>=\\?|string>\\?|string\\?|substring|symbol->string|symbol\\?|tan|transcript-off|transcript-on|truncate|values|vector|vector->list|vector-fill!|vector-length|vector-ref|vector-set!|vector\\?|write|write-char|zero\\?)$"
|
||||
))
|
||||
|
130
runtime/queries/spade/highlights.scm
Normal file
130
runtime/queries/spade/highlights.scm
Normal file
@ -0,0 +1,130 @@
|
||||
(self) @variable.builtin
|
||||
|
||||
(unit_definition (identifier) @function)
|
||||
|
||||
(parameter (identifier) @variable.parameter)
|
||||
|
||||
((pipeline_reg_marker) @keyword)
|
||||
|
||||
(scoped_identifier
|
||||
path: (identifier) @namespace)
|
||||
(scoped_identifier
|
||||
(scoped_identifier
|
||||
name: (identifier) @namespace))
|
||||
|
||||
((builtin_type) @type.builtin)
|
||||
|
||||
((identifier) @type.builtin
|
||||
(#any-of?
|
||||
@type.builtin
|
||||
"uint"
|
||||
"Option"
|
||||
"Memory"))
|
||||
|
||||
((identifier) @type.enum.variant.builtin
|
||||
(#any-of? @type.enum.variant.builtin "Some" "None"))
|
||||
|
||||
((pipeline_stage_name) @label)
|
||||
|
||||
((stage_reference
|
||||
stage: (identifier) @label))
|
||||
|
||||
[
|
||||
"pipeline"
|
||||
"let"
|
||||
"set"
|
||||
"entity"
|
||||
"fn"
|
||||
"reg"
|
||||
"reset"
|
||||
"initial"
|
||||
"inst"
|
||||
"assert"
|
||||
"struct"
|
||||
"enum"
|
||||
"stage"
|
||||
"impl"
|
||||
"port"
|
||||
"decl"
|
||||
"mod"
|
||||
"where"
|
||||
"trait"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"use"
|
||||
] @keyword.import
|
||||
|
||||
[
|
||||
"$if"
|
||||
"$else"
|
||||
"$config"
|
||||
] @keyword.directive
|
||||
|
||||
((comptime_if ["{" "}"] @keyword.directive))
|
||||
((comptime_else ["{" "}"] @keyword.directive))
|
||||
|
||||
((attribute) ["#" "[" "]"] @punctuation.delimiter)
|
||||
|
||||
[
|
||||
"else"
|
||||
"if"
|
||||
"match"
|
||||
] @keyword.control.conditional
|
||||
|
||||
(bool_literal) @constant.builtin.boolean
|
||||
(int_literal) @constant.numeric.integer
|
||||
|
||||
[
|
||||
"&"
|
||||
"inv"
|
||||
"-"
|
||||
"=>"
|
||||
">"
|
||||
"<"
|
||||
"::<"
|
||||
"::$<"
|
||||
"="
|
||||
"->"
|
||||
"~"
|
||||
"!"
|
||||
] @operator
|
||||
|
||||
|
||||
((op_add) @operator)
|
||||
((op_sub) @operator)
|
||||
((op_mul) @operator)
|
||||
((op_equals) @operator)
|
||||
((op_lt) @operator)
|
||||
((op_gt) @operator)
|
||||
((op_le) @operator)
|
||||
((op_ge) @operator)
|
||||
((op_lshift) @operator)
|
||||
((op_rshift) @operator)
|
||||
((op_bitwise_and) @operator)
|
||||
((op_bitwise_xor) @operator)
|
||||
((op_bitwise_or) @operator)
|
||||
((op_logical_and) @operator)
|
||||
((op_logical_or) @operator)
|
||||
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @comment
|
||||
|
||||
[
|
||||
(doc_comment)
|
||||
] @comment.block.documentation
|
||||
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "[A-Z]"))
|
||||
|
||||
((scoped_identifier
|
||||
name: (identifier) @type)
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
27
runtime/queries/spade/indents.scm
Normal file
27
runtime/queries/spade/indents.scm
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
[
|
||||
(unit_definition)
|
||||
(struct_definition)
|
||||
(enum_definition)
|
||||
(enum_member)
|
||||
(impl)
|
||||
(mod)
|
||||
(argument_list)
|
||||
(let_binding)
|
||||
(block)
|
||||
(tuple_literal)
|
||||
(array_literal)
|
||||
(paren_expression)
|
||||
(turbofish)
|
||||
(generic_parameters)
|
||||
(named_unpack)
|
||||
(positional_unpack)
|
||||
(tuple_pattern)
|
||||
] @indent
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
] @outdent
|
||||
|
@ -1,4 +1,4 @@
|
||||
(syscall) @function
|
||||
(syscall) @function.builtin
|
||||
(integer) @constant.numeric
|
||||
(pointer) @constant.numeric
|
||||
(value) @label
|
||||
|
@ -68,7 +68,9 @@
|
||||
"def"
|
||||
"defset"
|
||||
"defvar"
|
||||
"deftype"
|
||||
"assert"
|
||||
"dump"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
|
22
runtime/queries/textproto/highlights.scm
Normal file
22
runtime/queries/textproto/highlights.scm
Normal file
@ -0,0 +1,22 @@
|
||||
(string) @string
|
||||
|
||||
(field_name) @variable.other.member
|
||||
|
||||
(comment) @comment
|
||||
|
||||
(number) @constant.numeric
|
||||
; covers e.g. booleans and "inf"
|
||||
(scalar_value (identifier)) @constant
|
||||
; Covers "-inf"
|
||||
(scalar_value (signed_identifier)) @constant.numeric
|
||||
|
||||
[
|
||||
(open_squiggly)
|
||||
(close_squiggly)
|
||||
(open_square)
|
||||
(close_square)
|
||||
(open_arrow)
|
||||
(close_arrow)
|
||||
] @punctuation.bracket
|
||||
|
||||
"," @punctuation.delimiter
|
11
runtime/queries/textproto/indents.scm
Normal file
11
runtime/queries/textproto/indents.scm
Normal file
@ -0,0 +1,11 @@
|
||||
[
|
||||
(message_value)
|
||||
(message_list)
|
||||
(scalar_list)
|
||||
] @indent
|
||||
|
||||
[
|
||||
(close_arrow)
|
||||
(close_square)
|
||||
(close_squiggly)
|
||||
] @outdent
|
12
runtime/queries/textproto/textobjects.scm
Normal file
12
runtime/queries/textproto/textobjects.scm
Normal file
@ -0,0 +1,12 @@
|
||||
(message_field
|
||||
(_) @entry.inside) @entry.around
|
||||
|
||||
(scalar_field
|
||||
(_) @entry.inside) @entry.around
|
||||
|
||||
(message_list
|
||||
(_) @entry.around)
|
||||
|
||||
(scalar_list
|
||||
(_) @entry.around)
|
||||
|
@ -9,32 +9,25 @@
|
||||
;; Keywords
|
||||
[
|
||||
(kw_forall)
|
||||
(type_kw)
|
||||
(kw_equals)
|
||||
(do)
|
||||
(kw_let)
|
||||
(ability)
|
||||
(where)
|
||||
] @keyword
|
||||
|
||||
(kw_let) @keyword.function
|
||||
(type_kw) @keyword.storage.type
|
||||
(unique) @keyword.storage.modifier
|
||||
(type_kw) @keyword.storage.modifier
|
||||
(structural) @keyword.storage.modifier
|
||||
("use") @keyword.control.import
|
||||
|
||||
|
||||
[
|
||||
(type_constructor)
|
||||
] @constructor
|
||||
(unique) @keyword.storage.modifier
|
||||
|
||||
[
|
||||
(operator)
|
||||
(pipe)
|
||||
(arrow_symbol)
|
||||
(">")
|
||||
(or)
|
||||
(and)
|
||||
(bang)
|
||||
] @operator
|
||||
|
||||
[
|
||||
@ -48,24 +41,62 @@
|
||||
|
||||
(blank_pattern) @variable.builtin
|
||||
|
||||
(pattern) @variable
|
||||
|
||||
(use_clause) @keyword.import
|
||||
|
||||
;; Types
|
||||
(record_field name: (wordy_id) @variable.other.member type: (_) @type)
|
||||
(type_constructor (type_name (wordy_id) @constructor))
|
||||
(ability_declaration type_name: (wordy_id) @type type_arg: (wordy_id) @variable.parameter)
|
||||
(effect (wordy_id) @special) ;; NOTE: an effect is just like a type, but in signature we special case it
|
||||
(record_field
|
||||
(field_name) @variable.other.member
|
||||
type: (regular_identifier) @type)
|
||||
|
||||
;; Namespaces
|
||||
(path) @namespace
|
||||
(namespace) @namespace
|
||||
(type_name) @type
|
||||
|
||||
;; Terms
|
||||
(type_signature term_name: (path)? @variable term_name: (wordy_id) @variable)
|
||||
(type_signature (wordy_id) @type)
|
||||
(type_signature (term_type(delayed(wordy_id))) @type)
|
||||
(type_declaration
|
||||
(regular_identifier) @type.enum.variant)
|
||||
|
||||
(term_definition param: (wordy_id) @variable.parameter)
|
||||
(ability_name
|
||||
(path)? @namespace
|
||||
(regular_identifier) @type)
|
||||
|
||||
(function_application function_name: (path)? function_name: (wordy_id) @function)
|
||||
(ability_declaration
|
||||
(ability_name) @type
|
||||
(type_argument) @variable.parameter)
|
||||
|
||||
(type_constructor) @constructor
|
||||
|
||||
(constructor
|
||||
(constructor_name) @constructor)
|
||||
|
||||
(constructor
|
||||
type: (regular_identifier) @type)
|
||||
|
||||
(effect
|
||||
(regular_identifier) @special) ; NOTE: an effect is a special type
|
||||
|
||||
; Namespaces
|
||||
(path) @module
|
||||
|
||||
(namespace) @module
|
||||
|
||||
; Terms
|
||||
(type_signature
|
||||
term_name: (path) @module
|
||||
term_name: (regular_identifier) @variable)
|
||||
|
||||
(type_signature
|
||||
term_name: (regular_identifier) @variable)
|
||||
|
||||
(term_type) @type
|
||||
|
||||
(term_definition
|
||||
name: (path) @namespace)
|
||||
|
||||
(term_definition
|
||||
name: (regular_identifier) @variable)
|
||||
|
||||
(term_definition
|
||||
param: (regular_identifier) @variable.parameter)
|
||||
|
||||
;; Punctuation
|
||||
[
|
||||
@ -82,4 +113,6 @@
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
(test_watch_expression (wordy_id) @keyword.directive)
|
||||
(watch_expression) @keyword.directive
|
||||
|
||||
(test_watch_expression) @keyword.directive
|
||||
|
@ -1,11 +1,6 @@
|
||||
[
|
||||
(term_definition)
|
||||
(type_declaration)
|
||||
(pattern)
|
||||
(tuple_or_parenthesized)
|
||||
(literal_list)
|
||||
(tuple_pattern)
|
||||
(function_application)
|
||||
(exp_if)
|
||||
(constructor)
|
||||
(delay_block)
|
||||
|
15
runtime/queries/unison/textobjects.scm
Normal file
15
runtime/queries/unison/textobjects.scm
Normal file
@ -0,0 +1,15 @@
|
||||
(term_declaration) @function.around
|
||||
|
||||
(type_declaration) @class.inside
|
||||
(record) @class.inside
|
||||
|
||||
(comment) @comment.inside
|
||||
(comment)+ @comment.around
|
||||
|
||||
(doc_block) @comment.around
|
||||
|
||||
(literal_list) @entry.around
|
||||
|
||||
(parenthesized_or_tuple_pattern) @entry.around
|
||||
|
||||
(pattern) @entry.around
|
@ -40,6 +40,7 @@
|
||||
(float) @constant.numeric.float
|
||||
(integer) @constant.numeric.integer
|
||||
(comment) @comment
|
||||
[(path) (string) (json)] @string.special.path
|
||||
[(string) (json)] @string.special.path
|
||||
(path) @string.special.path
|
||||
(time) @string.special.symbol
|
||||
(boolean) @constant.builtin.boolean
|
||||
|
@ -1,13 +1,3 @@
|
||||
(block_mapping_pair
|
||||
key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member))
|
||||
(block_mapping_pair
|
||||
key: (flow_node (plain_scalar (string_scalar) @variable.other.member)))
|
||||
|
||||
(flow_mapping
|
||||
(_ key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member)))
|
||||
(flow_mapping
|
||||
(_ key: (flow_node (plain_scalar (string_scalar) @variable.other.member))))
|
||||
|
||||
(boolean_scalar) @constant.builtin.boolean
|
||||
(null_scalar) @constant.builtin
|
||||
(double_quote_scalar) @string
|
||||
@ -24,6 +14,16 @@
|
||||
(yaml_directive) @keyword
|
||||
(ERROR) @error
|
||||
|
||||
(block_mapping_pair
|
||||
key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member))
|
||||
(block_mapping_pair
|
||||
key: (flow_node (plain_scalar (string_scalar) @variable.other.member)))
|
||||
|
||||
(flow_mapping
|
||||
(_ key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.other.member)))
|
||||
(flow_mapping
|
||||
(_ key: (flow_node (plain_scalar (string_scalar) @variable.other.member))))
|
||||
|
||||
[
|
||||
","
|
||||
"-"
|
||||
|
@ -7,6 +7,18 @@
|
||||
(line_comment)
|
||||
] @comment.line
|
||||
|
||||
[
|
||||
variable: (IDENTIFIER)
|
||||
variable_type_function: (IDENTIFIER)
|
||||
] @variable
|
||||
|
||||
parameter: (IDENTIFIER) @variable.parameter
|
||||
|
||||
[
|
||||
field_member: (IDENTIFIER)
|
||||
field_access: (IDENTIFIER)
|
||||
] @variable.other.member
|
||||
|
||||
;; assume TitleCase is a type
|
||||
(
|
||||
[
|
||||
@ -36,6 +48,13 @@
|
||||
(#match? @constant "^[A-Z][A-Z_0-9]+$")
|
||||
)
|
||||
|
||||
[
|
||||
function_call: (IDENTIFIER)
|
||||
function: (IDENTIFIER)
|
||||
] @function
|
||||
|
||||
exception: "!" @keyword.control.exception
|
||||
|
||||
;; _
|
||||
(
|
||||
(IDENTIFIER) @variable.builtin
|
||||
@ -45,25 +64,6 @@
|
||||
;; C Pointers [*c]T
|
||||
(PtrTypeStart "c" @variable.builtin)
|
||||
|
||||
[
|
||||
variable: (IDENTIFIER)
|
||||
variable_type_function: (IDENTIFIER)
|
||||
] @variable
|
||||
|
||||
parameter: (IDENTIFIER) @variable.parameter
|
||||
|
||||
[
|
||||
field_member: (IDENTIFIER)
|
||||
field_access: (IDENTIFIER)
|
||||
] @variable.other.member
|
||||
|
||||
[
|
||||
function_call: (IDENTIFIER)
|
||||
function: (IDENTIFIER)
|
||||
] @function
|
||||
|
||||
exception: "!" @keyword.control.exception
|
||||
|
||||
field_constant: (IDENTIFIER) @constant
|
||||
|
||||
(BUILTINIDENTIFIER) @function.builtin
|
||||
|
110
runtime/themes/adwaita-light.toml
Normal file
110
runtime/themes/adwaita-light.toml
Normal file
@ -0,0 +1,110 @@
|
||||
inherits="adwaita-dark"
|
||||
"attribute" = "orange_5"
|
||||
|
||||
"type" = "teal_4"
|
||||
"type.builtin" = "teal_4"
|
||||
|
||||
"constructor" = "blue_4"
|
||||
|
||||
"constant" = "violet_4"
|
||||
"constant.builtin" = { fg = "violet_4", modifiers = ["bold"] }
|
||||
"constant.character" = "teal_5"
|
||||
"constant.numeric" = { fg = "teal_5", modifiers = ["bold"] }
|
||||
"constant.character.escape" = "violet_4"
|
||||
|
||||
"string" = "teal_3"
|
||||
"string.regexp" = "purple_4"
|
||||
"string.special" = "blue_4"
|
||||
|
||||
"comment" = "light_6"
|
||||
|
||||
"variable" = "dark_5"
|
||||
"variable.parameter" = "orange_4"
|
||||
"variable.builtin" = "orange_4"
|
||||
"variable.other" = "teal_4"
|
||||
"variable.other.member" = "teal_5"
|
||||
|
||||
"label" = "purple_4"
|
||||
|
||||
"punctuation" = "dark_4"
|
||||
"punctuation.delimiter" = "dark_4"
|
||||
"punctuation.bracket" = "dark_4"
|
||||
"punctuation.special" = "red_5"
|
||||
|
||||
"keyword" = { fg = "orange_4", modifiers = ["bold"] }
|
||||
"keyword.control" = { fg = "orange_4", modifiers = ["bold"] }
|
||||
"keyword.operator" = "purple_4"
|
||||
"keyword.directive" = { fg = "orange_4", modifiers = ["bold"] }
|
||||
"keyword.function" = "orange_4"
|
||||
"keyword.storage" = { fg = "orange_4", modifiers = ["bold"] }
|
||||
|
||||
"operator" = "purple_4"
|
||||
|
||||
"function" = "blue_4"
|
||||
"function.builtin" = "blue_4"
|
||||
"function.macro" = { fg = "blue_4", modifiers = ["bold"] }
|
||||
"function.special" = { fg = "blue_4", modifiers = ["bold"] }
|
||||
|
||||
"tag" = "teal_4"
|
||||
|
||||
"namespace" = "orange_4"
|
||||
|
||||
"markup" = "dark_4"
|
||||
"markup.heading" = { fg = "teal_4", modifiers = ["bold"] }
|
||||
"markup.list" = { fg = "orange_4", modifiers = ["bold"] }
|
||||
"markup.bold" = { fg = "dark_4", modifiers = ["bold"] }
|
||||
"markup.italic" = { fg = "dark_4", modifiers = ["italic"] }
|
||||
"markup.link" = { fg = "blue_5", modifiers = ["underlined"] }
|
||||
"markup.quote" = { fg = "dark_3", modifiers = ["italic"] }
|
||||
"diff.plus" = "teal_5"
|
||||
"diff.minus" = "red_3"
|
||||
"diff.delta" = "orange_5"
|
||||
"diff.delta.moved" = "orange_4"
|
||||
|
||||
"ui.background" = { fg = "dark_4", bg = "light_1" }
|
||||
"ui.background.separator" = { fg = "split_and_borders", bg = "light_2" }
|
||||
"ui.cursor" = { fg = "light_2", bg = "dark_5" }
|
||||
"ui.cursor.insert" = { fg = "light_2", bg = "dark_4" }
|
||||
"ui.cursor.primary.insert" = { fg = "light_2", bg = "yellow_5" }
|
||||
"ui.cursor.select" = { fg = "light_2", bg = "dark_5" }
|
||||
"ui.cursor.match" = { fg = "light_2", bg = "blue_1" }
|
||||
"ui.cursor.primary" = { fg = "light_2", bg = "dark_6" }
|
||||
"ui.linenr" = "light_5"
|
||||
"ui.linenr.selected" = { fg = "dark_2", bg = "light_3", modifiers = [
|
||||
"bold",
|
||||
] }
|
||||
"ui.statusline" = { fg = "dark_4", bg = "light_4" }
|
||||
"ui.statusline.inactive" = { fg = "dark_3", bg = "light_3" }
|
||||
"ui.statusline.insert" = { fg = "light_5", bg = "teal_3" }
|
||||
"ui.statusline.select" = { fg = "light_4", bg = "blue_3" }
|
||||
"ui.popup" = { bg = "light_3" }
|
||||
"ui.window" = "split_and_borders"
|
||||
"ui.help" = { bg = "light_3" }
|
||||
"ui.text" = "dark_4"
|
||||
"ui.virtual" = "light_1"
|
||||
"ui.virtual.ruler" = { bg = "light_5"}
|
||||
"ui.menu" = { fg = "dark_4", bg = "light_3" }
|
||||
"ui.menu.selected" = { fg = "dark_4", bg = "blue_1" }
|
||||
"ui.menu.scroll" = { fg = "dark_6", bg = "light_3" }
|
||||
"ui.selection" = { bg = "blue_0" }
|
||||
"ui.selection.primary" = { bg = "blue_0" }
|
||||
"ui.cursorline.primary" = { bg = "light_3" }
|
||||
"ui.virtual.whitespace" = "light_7"
|
||||
|
||||
"warning" = "yellow_4"
|
||||
"error" = "red_5"
|
||||
"info" = "purple_3"
|
||||
"hint" = "blue_3"
|
||||
|
||||
"diagnostic.hint" = { fg = "blue_4", modifiers = ["dim"] }
|
||||
"diagnostic.info" = { fg = "purple_4", modifiers = ["dim"] }
|
||||
"diagnostic.error" = { fg = "red_5", modifiers = ["underlined"] }
|
||||
"diagnostic.warning" = { fg = "yellow_4", modifiers = ["underlined"] }
|
||||
"diagnostic.unnecessary" = { modifiers = ["dim"] }
|
||||
"diagnostic.deprecated" = { modifiers = ["crossed_out"] }
|
||||
|
||||
"ui.bufferline" = { fg = "light_7", bg = "light_2" }
|
||||
"ui.bufferline.active" = { fg = "dark_4", bg = "light_4", modifiers = ["bold"]}
|
||||
|
||||
[palette]
|
||||
blue_0 = "#d3e4f9"
|
50
runtime/themes/carbonfox.toml
Normal file
50
runtime/themes/carbonfox.toml
Normal file
@ -0,0 +1,50 @@
|
||||
# Author: github.com/ETCaton
|
||||
# License: MIT License
|
||||
# Carbonfox
|
||||
#
|
||||
# Based on Helix's Nightfox port with changes to align it to Nightfox's Carbonfox theme
|
||||
# Any 'custom' colors are replicating the result of the linear color blending done in the original
|
||||
# Neovim theme.
|
||||
# https://github.com/EdenEast/nightfox.nvim/blob/d3e8b1acc095baf57af81bb5e89fe7c4359eb619/lua/nightfox/lib/color.lua#L236-L247
|
||||
|
||||
inherits = 'nightfox'
|
||||
|
||||
# DIAGNOSTICS
|
||||
# For brevity: All blends here are a blend between bg1 and the fg value with factor of 0.15
|
||||
"warning" = { fg = "magenta", bg = "#2f2939" }
|
||||
"error.bg" = "#361f29"
|
||||
"info.bg" = "#252c39"
|
||||
"hint" = { fg = "orange", bg = "#1c3433" }
|
||||
|
||||
[palette]
|
||||
black = "#282828"
|
||||
red = "#ee5396"
|
||||
red-dim = "#ca4780"
|
||||
green = "#25be6a"
|
||||
green-dim = "#1fa25a"
|
||||
yellow = "#08bdba"
|
||||
yellow-bright = "#2dc7c4"
|
||||
blue = "#78a9ff"
|
||||
blue-bright = "#8cb6ff"
|
||||
blue-dim = "#6690d9"
|
||||
magenta = "#be95ff"
|
||||
magenta-bright = "#c8a5ff"
|
||||
cyan = "#33b1ff"
|
||||
cyan-bright = "#52bdff"
|
||||
cyan-dim = "#2b96d9"
|
||||
orange = "#3ddbd9"
|
||||
orange-bright = "#5ae0df"
|
||||
pink = "#ff7eb6"
|
||||
pink-bright = "#ff91c1"
|
||||
# spec
|
||||
bg0 = "#0c0c0c"
|
||||
bg1 = "#161616"
|
||||
bg2 = "#252525"
|
||||
bg3 = "#353535"
|
||||
bg4 = "#535353"
|
||||
fg0 = "#f9fbff"
|
||||
fg1 = "#f2f4f8"
|
||||
fg2 = "#b6b8bb"
|
||||
fg3 = "#7b7c7e"
|
||||
sel0 = "#2a2a2a"
|
||||
sel1 = "#525253"
|
180
runtime/themes/eiffel.toml
Normal file
180
runtime/themes/eiffel.toml
Normal file
@ -0,0 +1,180 @@
|
||||
## Author: mesmere <95945959+mesmere@users.noreply.github.com>
|
||||
## Original design by Ian Joyner
|
||||
|
||||
"attribute" = { fg = "markup", modifiers = ["italic"] }
|
||||
"comment" = "comments"
|
||||
"comment.block" = "comments"
|
||||
"comment.block.documentation" = "comments"
|
||||
"comment.line" = "comments"
|
||||
#"constant" = ""
|
||||
"constant.builtin" = { fg = "builtins", modifiers = ["italic"] }
|
||||
"constant.character" = "strings"
|
||||
"constant.character.escape" = "symbols"
|
||||
"constant.numeric" = { fg = "constants_numeric", modifiers = ["italic"] }
|
||||
"constructor" = { modifiers = ["italic"] }
|
||||
"function" = { fg = "members" }
|
||||
"function.builtin" = "builtins"
|
||||
"function.macro" = "preprocessor"
|
||||
"function.method" = { fg = "members", modifiers = ["italic"] }
|
||||
#"function.method.private" = ""
|
||||
"function.special" = "preprocessor"
|
||||
"keyword" = { fg = "ui_text" }
|
||||
"keyword.control" = { fg = "keywords", modifiers = ["bold"] }
|
||||
"keyword.directive" = { fg = "preprocessor", modifiers = ["bold"] }
|
||||
#"keyword.function" = ""
|
||||
"keyword.operator" = { fg = "operators", modifiers = ["italic"] }
|
||||
#"keyword.storage" = ""
|
||||
#"label" = ""
|
||||
#"namespace" = ""
|
||||
"operator" = { fg = "operators", modifiers = ["bold"] }
|
||||
#"punctuation" = ""
|
||||
#"punctuation.bracket" = ""
|
||||
#"punctuation.delimiter" = ""
|
||||
"punctuation.special" = "strings"
|
||||
#"special" = ""
|
||||
"string" = "strings"
|
||||
"string.regexp" = "symbols"
|
||||
"string.special" = "symbols"
|
||||
"tag" = "markup"
|
||||
"type" = { modifiers = ["italic"] }
|
||||
#"type.builtin" = ""
|
||||
#"type.enum" = ""
|
||||
#"type.parameter" = ""
|
||||
#"variable" = ""
|
||||
"variable.builtin" = "builtins"
|
||||
"variable.other.member" = { fg = "members", modifiers = ["italic"] }
|
||||
#"variable.other.member.private" = ""
|
||||
#"variable.parameter" = ""
|
||||
"markup" = "markup"
|
||||
"markup.heading" = { fg = "markup_headings", modifiers = ["bold"] }
|
||||
#"markup.heading.marker" = ""
|
||||
"markup.list" = "markup_lists"
|
||||
"markup.bold" = { modifiers = ["bold"] }
|
||||
"markup.italic" = { modifiers = ["italic"] }
|
||||
"markup.strikethrough" = { modifiers = ["crossed_out"] }
|
||||
"markup.link.url" = { fg = "strings", underline.style = "line" } # Match HTML href/src attributes.
|
||||
#"markup.link.label" = ""
|
||||
"markup.link.text" = "ui_text"
|
||||
"markup.quote" = { fg = "black", modifiers = ["italic"] }
|
||||
"markup.raw" = "strings"
|
||||
#"markup.raw.inline" = ""
|
||||
#"markup.raw.block" = ""
|
||||
|
||||
"diff.delta" = "diff_delta"
|
||||
"diff.minus" = "diff_minus"
|
||||
"diff.plus" = "diff_plus"
|
||||
|
||||
"ui.background" = { bg = "ui_background" }
|
||||
#"ui.background.separator" = ""
|
||||
"ui.bufferline" = { fg = "ui_text_dim", bg = "ui_background_accent" }
|
||||
"ui.bufferline.active" = { fg = "ui_text", bg = "ui_background_accent" }
|
||||
"ui.bufferline.background" = { bg = "ui_background_accent" }
|
||||
#"ui.cursor" = { modifiers = ['reversed'] }
|
||||
"ui.cursor.insert" = { bg = "ui_mode_insert_accent" }
|
||||
"ui.cursor.match" = { modifiers = ['reversed'] }
|
||||
"ui.cursor.normal" = { bg = "ui_mode_normal_accent" }
|
||||
"ui.cursor.select" = { bg = "ui_mode_select_accent" }
|
||||
#"ui.cursor.primary" = ""
|
||||
"ui.cursor.primary.insert" = { bg = "ui_mode_insert" }
|
||||
#"ui.cursor.primary.match" = ""
|
||||
"ui.cursor.primary.normal" = { bg = "ui_mode_normal" }
|
||||
"ui.cursor.primary.select" = { bg = "ui_mode_select" }
|
||||
"ui.cursorcolumn.primary" = { bg = "ui_background_accent" }
|
||||
#"ui.cursorcolumn.secondary" = ""
|
||||
"ui.cursorline.primary" = { bg = "ui_background_accent" }
|
||||
#"ui.cursorline.secondary" = ""
|
||||
"ui.debug.active" = { fg = "ui_debug_breakpoint" }
|
||||
"ui.debug.breakpoint" = { fg = "ui_debug_breakpoint" }
|
||||
"ui.gutter" = { bg = "ui_background" }
|
||||
"ui.gutter.selected" = { bg = "ui_background_accent" }
|
||||
"ui.help" = { fg = "ui_text", bg = "ui_menu" }
|
||||
"ui.highlight" = { fg = "ui_highlight_line_text", bg = "ui_highlight_line" } # fg is not respected https://github.com/helix-editor/helix/issues/11141
|
||||
"ui.highlight.frameline" = { fg = "ui_highlight_line_text", bg = "ui_highlight_line" }
|
||||
"ui.linenr" = "ui_text_dim"
|
||||
"ui.linenr.selected" = { fg = "ui_text_dim", bg = "ui_background_accent" }
|
||||
"ui.menu" = { fg = "ui_menu_text", bg = "ui_menu" }
|
||||
"ui.menu.scroll" = { fg = "ui_menu_handle", bg = "ui_menu_selected" }
|
||||
"ui.menu.selected" = { fg = "ui_text", bg = "ui_menu_selected" }
|
||||
#"ui.picker" = { fg = "ui_text", bg = "ui_menu" } # Styling the picker is currently unsupported.
|
||||
"ui.picker.header" = { bg = "ui_background_accent" }
|
||||
"ui.picker.header.column" = "ui_text"
|
||||
"ui.picker.header.column.active" = { fg = "ui_text", modifiers = ["bold"], underline = { style = "line" } }
|
||||
"ui.popup" = { fg = "ui_text", bg = "ui_background_accent" }
|
||||
"ui.popup.info" = { fg = "ui_text", bg = "ui_menu" }
|
||||
"ui.selection" = { bg = "ui_selection" }
|
||||
#"ui.selection.primary" = { bg = "ui_selection", underline.style = "line" }
|
||||
"ui.statusline" = { fg = "ui_text", bg = "ui_background_accent" }
|
||||
#"ui.statusline.inactive" = { fg = "", bg = "" }
|
||||
"ui.statusline.insert" = { fg = "ui_mode_insert_text", bg = "ui_mode_insert", modifiers = ["bold"] }
|
||||
"ui.statusline.normal" = { fg = "ui_mode_normal_text", bg = "ui_mode_normal", modifiers = ["bold"] }
|
||||
"ui.statusline.select" = { fg = "ui_mode_select_text", bg = "ui_mode_select", modifiers = ["bold"] }
|
||||
"ui.text" = "ui_text"
|
||||
"ui.text.focus" = { fg = "ui_text", modifiers = ["bold"] }
|
||||
"ui.text.inactive" = "ui_text_dim"
|
||||
#"ui.text.info" = ""
|
||||
"ui.virtual.indent-guide" = "ui_text_dim"
|
||||
"ui.virtual.inlay-hint" = "ui_text_dim"
|
||||
#"ui.virtual.inlay-hint.parameter" = ""
|
||||
#"ui.virtual.inlay-hint.type" = ""
|
||||
"ui.virtual.jump-label" = { fg = "white", bg = "ui_jumplabel", modifiers = ["bold"] }
|
||||
"ui.virtual.ruler" = { bg = "ui_background_accent" }
|
||||
"ui.virtual.whitespace" = "ui_text_dim"
|
||||
"ui.virtual.wrap" = "ui_text_dim"
|
||||
"ui.window" = "ui_split_line"
|
||||
|
||||
info = { fg = 'ui_diagnostic_info' }
|
||||
hint = { fg = 'ui_diagnostic_hint', modifiers = ['bold'] }
|
||||
warning = { fg = 'ui_diagnostic_warning', modifiers = ['bold'] }
|
||||
error = { fg = 'ui_diagnostic_error', modifiers = ['bold'] }
|
||||
|
||||
"diagnostic.info" = { fg = "ui_diagnostic_info", underline = { style = "curl", color = "ui_diagnostic_info" } }
|
||||
"diagnostic.hint" = { fg = "ui_diagnostic_hint", underline = { style = "curl", color = "ui_diagnostic_hint" } }
|
||||
"diagnostic.warning" = { fg = "ui_diagnostic_warning", underline = { style = "curl", color = "ui_diagnostic_warning" } }
|
||||
"diagnostic.error" = { fg = "ui_diagnostic_error", underline = { style = "curl", color = "ui_diagnostic_error" } }
|
||||
"diagnostic.unnecessary" = { modifiers = ["dim"] }
|
||||
"diagnostic.deprecated" = { modifiers = ["crossed_out"] }
|
||||
|
||||
[palette]
|
||||
builtins = "#585cf6"
|
||||
comments = "#00b418"
|
||||
constants_numeric = "#cd0000"
|
||||
diff_delta = "#0000a2"
|
||||
diff_minus = "#990000"
|
||||
diff_plus = "#00b418"
|
||||
keywords = "#0100b6"
|
||||
markup = "#1c02ff"
|
||||
markup_headings = "#0c07ff"
|
||||
markup_lists = "#b90690"
|
||||
members = "#0206ff"
|
||||
operators = "#0100b6"
|
||||
preprocessor = "#0c450d"
|
||||
strings = "#d80800"
|
||||
symbols = "#26b31a"
|
||||
ui_background = "#ffffff"
|
||||
ui_background_accent = "#ededed"
|
||||
ui_highlight_line = "#0100b6"
|
||||
ui_highlight_line_text = "#ffffff"
|
||||
ui_debug_breakpoint = "#990000"
|
||||
ui_diagnostic_error = "#990000"
|
||||
ui_diagnostic_hint = "#06960e"
|
||||
ui_diagnostic_info = "#808080"
|
||||
ui_diagnostic_warning = "#fafa28"
|
||||
ui_jumplabel = "#990000"
|
||||
ui_menu = "#c3dcff"
|
||||
ui_menu_selected = "#a3bcdf"
|
||||
ui_menu_handle = "#839cbf"
|
||||
ui_menu_text = "#000000"
|
||||
ui_mode_insert = "#009608"
|
||||
ui_mode_insert_accent = "#73e678"
|
||||
ui_mode_insert_text = "#ffffff"
|
||||
ui_mode_normal = "#444444"
|
||||
ui_mode_normal_accent = "#cccccc"
|
||||
ui_mode_normal_text = "#ffffff"
|
||||
ui_mode_select = "#000096"
|
||||
ui_mode_select_accent = "#7373e6"
|
||||
ui_mode_select_text = "#ffffff"
|
||||
ui_selection = "#c3dcff"
|
||||
ui_split_line = "#000000"
|
||||
ui_statusline = "#000000"
|
||||
ui_text = "#000000"
|
||||
ui_text_dim = "#808080"
|
@ -1,13 +1,15 @@
|
||||
# Author : portalsurfer <https://github.com/PORTALSURFER>
|
||||
|
||||
inherits = "hex_steel"
|
||||
|
||||
[palette]
|
||||
t1 = "#0e0e0d"
|
||||
t2 = "#121311"
|
||||
t2 = "#181a17"
|
||||
t3 = "#2b3444"
|
||||
t4 = "#61586f"
|
||||
t5 = "#686e73"
|
||||
t6 = "#878480"
|
||||
t7 = "#897dca"
|
||||
t7 = "#8e80de"
|
||||
t8 = "#7b89a3"
|
||||
t9 = "#bcb6ba"
|
||||
t10 = "#9db2b8"
|
||||
@ -20,12 +22,20 @@ highlight_three = "#29bbff"
|
||||
black = "#000000"
|
||||
|
||||
selection = "#290019"
|
||||
selection_fg = "#958e9a"
|
||||
|
||||
comment = "#9aacfe"
|
||||
comment = "#404768"
|
||||
comment_doc = "#0affa9"
|
||||
|
||||
error = "#ff0900"
|
||||
warning = "#ffbf00"
|
||||
display = "#57ff89"
|
||||
info = "#dad7d5"
|
||||
#
|
||||
|
||||
hints = "#44273f"
|
||||
ruler = "#1c1f1b"
|
||||
|
||||
diff_minus = "#ff4000"
|
||||
diff_delta = "#0078bd"
|
||||
diff_plus = "#c9d400"
|
||||
diff_delta_moved = "#0048bd"
|
41
runtime/themes/hex_poison.toml
Normal file
41
runtime/themes/hex_poison.toml
Normal file
@ -0,0 +1,41 @@
|
||||
# Author : portalsurfer <https://github.com/PORTALSURFER>
|
||||
|
||||
inherits = "hex_steel"
|
||||
|
||||
[palette]
|
||||
t1 = "#121211"
|
||||
t2 = "#1e1f1b"
|
||||
t3 = "#4c513a"
|
||||
t4 = "#5a6052"
|
||||
t5 = "#6f6d6f"
|
||||
t8 = "#7e808a"
|
||||
t7 = "#b1b354"
|
||||
t10 = "#6fa197"
|
||||
t9 = "#3f4a4e"
|
||||
t6 = "#98acaa"
|
||||
t11 = "#6fd7a8"
|
||||
|
||||
highlight = "#ff2e5f"
|
||||
highlight_two = "#0affa9"
|
||||
highlight_three = "#d7ff52"
|
||||
|
||||
black = "#000000"
|
||||
|
||||
selection = "#290019"
|
||||
selection_fg = "#c8e732"
|
||||
|
||||
comment = "#396884"
|
||||
comment_doc = "#234048"
|
||||
|
||||
error = "#c73500"
|
||||
warning = "#dcbb00"
|
||||
display = "#57ff89"
|
||||
info = "#dad7d5"
|
||||
|
||||
hints = "#313d3c"
|
||||
ruler = "#21221e"
|
||||
|
||||
diff_minus = "#ff4000"
|
||||
diff_delta = "#16a7c7"
|
||||
diff_plus = "#c9d400"
|
||||
diff_delta_moved = "#0048bd"
|
@ -1,14 +1,16 @@
|
||||
# Author : portalsurfer <https://github.com/PORTALSURFER>
|
||||
|
||||
"comment" = { fg = "comment" }
|
||||
"comment.block.documentation" = { bg = "comment_doc", modifiers = ["italic"] }
|
||||
|
||||
"constant" = { fg = "t11" }
|
||||
"function" = { fg = "t10" }
|
||||
"function.method" = { fg = "t10" }
|
||||
"function.method" = { fg = "t7" }
|
||||
"function.macro" = { fg = "t7" }
|
||||
"keyword.storage.modifier" = { fg = "t7" }
|
||||
"keyword.control.import" = { fg = "t8" }
|
||||
"keyword.control" = { fg = "t8" }
|
||||
"keyword.function" = { fg = "t7" }
|
||||
"keyword.function" = { fg = "t11" }
|
||||
"keyword" = { fg = "t6" }
|
||||
"operator" = { fg = "t8" }
|
||||
"punctuation" = { fg = "t9" }
|
||||
@ -18,6 +20,8 @@
|
||||
"type" = { fg = "t8", modifiers = ["bold"] }
|
||||
"namespace" = { fg = "t6", modifiers = ["bold"] }
|
||||
"variable" = { fg = "t4" }
|
||||
"variable.parameter" = { fg = "t6" }
|
||||
"variable.other.member" = { fg = "t3" }
|
||||
"label" = { fg = "t4" }
|
||||
|
||||
"diff.plus" = { fg = "diff_plus" }
|
||||
@ -25,10 +29,12 @@
|
||||
"diff.delta.moved" = { fg = "diff_delta_moved" }
|
||||
"diff.minus" = { fg = "diff_minus" }
|
||||
|
||||
"ui.cursor.insert" = { fg = "t2", bg = "highlight" }
|
||||
"ui.cursor.select" = { fg = "t2", bg = "highlight_two" }
|
||||
"ui.cursor" = { fg = "t1", bg = "highlight_three" }
|
||||
"ui.cursor.match" = { fg = "highlight", bg = "selection", modifiers = ["bold"] }
|
||||
"ui.cursor.primary.insert" = { fg = "t2", bg = "highlight" }
|
||||
"ui.cursor.primary.select" = { fg = "t2", bg = "highlight_two" }
|
||||
"ui.cursor.primary" = { fg = "t1", bg = "highlight_three" }
|
||||
"ui.cursor.match" = { fg = "highlight", bg = "t1", modifiers = ["bold"] }
|
||||
"ui.cursorline.primary" = { bg = "ruler" }
|
||||
"ui.cursorline.secondary" = { bg = "ruler" }
|
||||
|
||||
"ui.linenr" = { fg = "t3", bg = "t2" }
|
||||
"ui.linenr.selected" = { fg = "highlight_three", bg = "t2" }
|
||||
@ -42,10 +48,7 @@
|
||||
"ui.popup" = { fg = "t4", bg = "t1" }
|
||||
"ui.window" = { fg = "t4" }
|
||||
|
||||
"ui.selection.primary" = { bg = "selection" }
|
||||
"ui.selection" = { bg = "selection" }
|
||||
|
||||
"ui.cursorline.primary" = { bg = "t1" }
|
||||
"ui.selection" = { fg = "selection_fg", bg = "selection" }
|
||||
|
||||
"ui.statusline" = { fg = "t4", bg = "t1" }
|
||||
"ui.statusline.inactive" = { fg = "t4", bg = "t1" }
|
||||
@ -55,17 +58,20 @@
|
||||
|
||||
"ui.text" = { fg = "t4" }
|
||||
"ui.text.focus" = { fg = "highlight_three", modifiers = ["bold"] }
|
||||
#
|
||||
"ui.virtual.ruler" = { bg = "t1" }
|
||||
|
||||
"ui.virtual.ruler" = { bg = "ruler" }
|
||||
"ui.virtual.indent-guide" = { fg = "t3" }
|
||||
"ui.virtual.whitespace" = { fg = "t3" }
|
||||
"ui.virtual.jump-label" = { fg = "t11", modifiers = ["bold"] }
|
||||
"ui.virtual.inlay-hint" = { fg = "hints", modifiers = ["bold"] }
|
||||
|
||||
"ui.bufferline" = { fg = "t3", bg = "t1" }
|
||||
"ui.bufferline.active" = { fg = "t7", bg = "t2" }
|
||||
|
||||
"diagnostic.error" = { underline = { color = "error", style = "curl" } }
|
||||
"diagnostic.warning" = { underline = { color = "warning", style = "curl" } }
|
||||
"diagnostic.info" = { underline = { color = "info", style = "curl" } }
|
||||
"diagnostic.hint" = { underline = { color = "display", style = "curl" } }
|
||||
"diagnostic.unnecessary" = { modifiers = ["dim"] }
|
||||
"diagnostic.deprecated" = { modifiers = ["crossed_out"] }
|
||||
|
||||
"error" = { fg = "error", modifiers = ["bold"] }
|
||||
"warning" = { fg = "warning", modifiers = ["bold"] }
|
||||
@ -73,14 +79,14 @@
|
||||
"hint" = { fg = "display", modifiers = ["bold"] }
|
||||
"special" = { fg = "t7", modifiers = ["bold"] }
|
||||
|
||||
"markup.heading" = { fg = "t4" }
|
||||
"markup.list" = { fg = "t4" }
|
||||
"markup.heading" = { fg = "t7" }
|
||||
"markup.list" = { fg = "t7" }
|
||||
"markup.bold" = { fg = "t4" }
|
||||
"markup.italic" = { fg = "t4" }
|
||||
"markup.strikethrough" = { fg = "t4", modifiers = ["crossed_out"] }
|
||||
"markup.link.url" = { fg = "t4", modifiers = ["underlined"] }
|
||||
"markup.link.text" = { fg = "t4" }
|
||||
"markup.quote" = { fg = "t4" }
|
||||
"markup.link.url" = { fg = "t11", modifiers = ["underlined"] }
|
||||
"markup.link.text" = { fg = "t11" }
|
||||
"markup.quote" = { fg = "t5" }
|
||||
"markup.raw" = { fg = "t4" }
|
||||
|
||||
[palette]
|
||||
@ -93,25 +99,28 @@ t6 = "#6e8789"
|
||||
t7 = "#d85c60"
|
||||
t8 = "#9bc1bb"
|
||||
t9 = "#b5c5c5"
|
||||
t10 = "#c0d0ce"
|
||||
t10 = "#c3c3bd"
|
||||
t11 = "#f78c5e"
|
||||
|
||||
highlight = "#3f36f2"
|
||||
highlight = "#f23672"
|
||||
highlight_two = "#f69c3c"
|
||||
highlight_three = "#d4d987"
|
||||
|
||||
selection = "#032d4a"
|
||||
selection = "#4a9aa6"
|
||||
selection_fg = "#080a0b"
|
||||
|
||||
black = "#000000"
|
||||
comment = "#d4d987"
|
||||
comment = "#654642"
|
||||
comment_doc = "#234048"
|
||||
hints = "#31353c"
|
||||
ruler = "#222320"
|
||||
|
||||
error = "#ff0900"
|
||||
error = "#ff4000"
|
||||
warning = "#ffbf00"
|
||||
display = "#42baff"
|
||||
info = "#dad7d5"
|
||||
|
||||
diff_minus = "#ff0900"
|
||||
diff_minus = "#ff4000"
|
||||
diff_delta = "#0078bd"
|
||||
diff_plus = "#87a800"
|
||||
diff_plus = "#c9d400"
|
||||
diff_delta_moved = "#0048bd"
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Author : portalsurfer <https://github.com/PORTALSURFER>
|
||||
|
||||
inherits = "hex_steel"
|
||||
|
||||
[palette]
|
||||
@ -19,12 +21,21 @@ highlight_three = "#f8ed8b"
|
||||
|
||||
black = "#000000"
|
||||
|
||||
selection = "#382e1e"
|
||||
selection = "#b10656"
|
||||
selection_fg = "#101719"
|
||||
|
||||
comment = "#61bdd1"
|
||||
comment = "#417e8c"
|
||||
comment_doc = "#234048"
|
||||
|
||||
error = "#ff0900"
|
||||
warning = "#ffbf00"
|
||||
display = "#57ff89"
|
||||
info = "#dad7d5"
|
||||
|
||||
hints = "#39515c"
|
||||
ruler = "#1e3039"
|
||||
|
||||
diff_minus = "#ff4000"
|
||||
diff_delta = "#0078bd"
|
||||
diff_plus = "#c9d400"
|
||||
diff_delta_moved = "#0048bd"
|
21
runtime/themes/licenses/carbonfox.license
Normal file
21
runtime/themes/licenses/carbonfox.license
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 James Simpson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1,6 +1,6 @@
|
||||
# Author: Alexis Mousset <contact@amousset.me>
|
||||
# Adapted from https://protesilaos.com/emacs/modus-themes, by Protesilaos Stavrou
|
||||
# Version 4.4.0
|
||||
# Version 4.6.0
|
||||
#
|
||||
|
||||
# Syntax highlighting
|
||||
|
@ -2,7 +2,7 @@
|
||||
# modus_operandi.toml variant
|
||||
#
|
||||
# This variant is optimized for users with red-green color deficiency (deuteranopia)
|
||||
# Version 4.4.0
|
||||
# Version 4.6.0
|
||||
|
||||
inherits = "modus_operandi"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Author: Alexis Mousset <contact@amousset.me>
|
||||
# modus_operandi.toml variant
|
||||
# Version 4.4.0
|
||||
# Version 4.6.0
|
||||
|
||||
inherits = "modus_operandi"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# modus_operandi.toml variant
|
||||
#
|
||||
# This variant is optimized for users with blue-yellow color deficiency (tritanopia)
|
||||
# Version 4.4.0
|
||||
# Version 4.6.0
|
||||
|
||||
inherits = "modus_operandi"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Author: Matous Dzivjak <matousdzivjak@gmail.com>
|
||||
# Adapted from https://protesilaos.com/emacs/modus-themes, by Protesilaos Stavrou
|
||||
# Source: https://github.com/protesilaos/modus-themes/blob/main/modus-vivendi-theme.el
|
||||
# Version 4.4.0
|
||||
# Version 4.6.0
|
||||
|
||||
# Syntax highlighting
|
||||
# -------------------
|
||||
@ -124,7 +124,7 @@ bg-inactive = "#303030"
|
||||
# Common accent foregrounds
|
||||
red = "#ff5f59"
|
||||
red-warmer = "#ff6b55"
|
||||
red-cooler = "#ff7f9f"
|
||||
red-cooler = "#ff7f86"
|
||||
red-faint = "#ff9580"
|
||||
red-intense = "#ff5f5f"
|
||||
green = "#44bc44"
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Author: Matous Dzivjak <matousdzivjak@gmail.com>
|
||||
# Adapted from https://protesilaos.com/emacs/modus-themes, by Protesilaos Stavrou
|
||||
# Source: https://github.com/protesilaos/modus-themes/blob/main/modus-vivendi-deuteranopia-theme.el
|
||||
# Version 4.3.0
|
||||
# Version 4.6.0
|
||||
|
||||
inherits = "modus_vivendi"
|
||||
|
||||
@ -37,7 +37,7 @@ border = "#646464"
|
||||
# Common accent foregrounds
|
||||
red = "#ff5f59"
|
||||
red-warmer = "#ff6b55"
|
||||
red-cooler = "#ff7f9f"
|
||||
red-cooler = "#ff7f86"
|
||||
red-faint = "#ff9580"
|
||||
red-intense = "#ff5f5f"
|
||||
green = "#44bc44"
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Author: Matous Dzivjak <matousdzivjak@gmail.com>
|
||||
# Adapted from: https://protesilaos.com/emacs/modus-themes, by Protesilaos Stavrou
|
||||
# Source: https://github.com/protesilaos/modus-themes/blob/main/modus-vivendi-tinted-theme.el
|
||||
# Version 4.4.0
|
||||
# Version 4.6.0
|
||||
|
||||
inherits = "modus_vivendi"
|
||||
|
||||
@ -23,7 +23,7 @@ border = "#61647a"
|
||||
# Common accent foregrounds
|
||||
red = "#ff5f59"
|
||||
red-warmer = "#ff6b55"
|
||||
red-cooler = "#ff7f9f"
|
||||
red-cooler = "#ff7f86"
|
||||
red-faint = "#ff9f80"
|
||||
red-intense = "#ff5f5f"
|
||||
green = "#44bc44"
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Author: Matous Dzivjak <matousdzivjak@gmail.com>
|
||||
# Adapted from https://protesilaos.com/emacs/modus-themes, by Protesilaos Stavrou
|
||||
# Source: https://github.com/protesilaos/modus-themes/blob/main/modus-vivendi-tritanopia-theme.el
|
||||
# Version 4.3.0
|
||||
# Version 4.6.0
|
||||
|
||||
inherits = "modus_vivendi"
|
||||
|
||||
@ -51,7 +51,7 @@ border = "#646464"
|
||||
# Common accent foregrounds
|
||||
red = "#ff5f59"
|
||||
red-warmer = "#ff6740"
|
||||
red-cooler = "#ff6f9f"
|
||||
red-cooler = "#ff7f86"
|
||||
red-faint = "#ff9070"
|
||||
red-intense = "#ff5f5f"
|
||||
green = "#44bc44"
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Author: Shafkath Shuhan <shafkathshuhannyc@gmail.com>
|
||||
|
||||
"tag" = { fg = "tag" }
|
||||
|
||||
"namespace" = { fg = "type" }
|
||||
"module" = { fg = "type" }
|
||||
|
||||
@ -116,3 +118,4 @@ cursor = "#a6a6a6"
|
||||
inactive_cursor = "#878b91"
|
||||
widget = "#1e1f1c"
|
||||
selection = "#414339"
|
||||
tag = "#F92672"
|
||||
|
@ -74,9 +74,9 @@
|
||||
|
||||
"ui.statusline" = { fg = "white", bg = "light-black" }
|
||||
"ui.statusline.inactive" = { fg = "light-gray", bg = "light-black" }
|
||||
"ui.statusline.normal" = { fg = "light-black", bg = "purple" }
|
||||
"ui.statusline.insert" = { fg = "light-black", bg = "green" }
|
||||
"ui.statusline.select" = { fg = "light-black", bg = "cyan" }
|
||||
"ui.statusline.normal" = { fg = "light-black", bg = "purple", modifiers = ["bold"] }
|
||||
"ui.statusline.insert" = { fg = "light-black", bg = "green", modifiers = ["bold"] }
|
||||
"ui.statusline.select" = { fg = "light-black", bg = "cyan", modifiers = ["bold"] }
|
||||
|
||||
"ui.bufferline" = { fg = "light-gray", bg = "light-black" }
|
||||
"ui.bufferline.active" = { fg = "light-black", bg = "blue", underline = { color = "light-black", style = "line" } }
|
||||
|
16
runtime/themes/seoul256-dark-hard.toml
Normal file
16
runtime/themes/seoul256-dark-hard.toml
Normal file
@ -0,0 +1,16 @@
|
||||
# Seoul256 Dark Hard
|
||||
# Author : EricHenry
|
||||
# Original Creator: https://github.com/junegunn/seoul256.vim
|
||||
|
||||
inherits = "seoul256-dark"
|
||||
|
||||
"ui.background" = { bg = "gray1" }
|
||||
"ui.gutter" = { bg = "gray2" }
|
||||
"ui.cursorline.primary" = { bg = "gray" }
|
||||
"ui.gutter.selected" = { bg = "gray" }
|
||||
"ui.linenr.selected" = { bg = "gray", fg = "magenta", modifiers = ["bold"] }
|
||||
"ui.virtual.inlay-hint" = { fg = "gray4", modifiers = ["bold"] }
|
||||
|
||||
"ui.help" = { bg = "gray" }
|
||||
"ui.popup" = { bg = "gray" }
|
||||
"ui.menu" = { bg = "gray" }
|
15
runtime/themes/seoul256-dark-soft.toml
Normal file
15
runtime/themes/seoul256-dark-soft.toml
Normal file
@ -0,0 +1,15 @@
|
||||
# Seoul256 Dark Soft
|
||||
# Author : EricHenry
|
||||
# Original Creator: https://github.com/junegunn/seoul256.vim
|
||||
|
||||
inherits = "seoul256-dark"
|
||||
|
||||
"ui.background" = { bg = "gray8" }
|
||||
"ui.gutter" = { bg = "gray6" }
|
||||
"ui.cursorline.primary" = { bg = "gray5" }
|
||||
"ui.gutter.selected" = { bg = "gray5" }
|
||||
"ui.linenr.selected" = { bg = "gray5", fg = "magenta", modifiers = ["bold"] }
|
||||
|
||||
"ui.help" = { bg = "gray5" }
|
||||
"ui.popup" = { bg = "gray5" }
|
||||
"ui.menu" = { bg = "gray5" }
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user