Compare commits
No commits in common. "6cff0d8836f1e6ca47885330fdc5b2a3440a87b4" and "2877fe103f739b9f535ee32b8220fed4ddf2d4de" have entirely different histories.
6cff0d8836
...
2877fe103f
625
Cargo.lock
generated
625
Cargo.lock
generated
|
@ -2,6 +2,12 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "adler32"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.2"
|
||||
|
@ -11,6 +17,21 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android-tzdata"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.12.1"
|
||||
|
@ -20,6 +41,12 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
|
@ -31,12 +58,30 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.83"
|
||||
|
@ -46,6 +91,26 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.34.0"
|
||||
|
@ -54,19 +119,100 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
|||
dependencies = [
|
||||
"ansi_term",
|
||||
"atty",
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
"strsim",
|
||||
"textwrap",
|
||||
"unicode-width",
|
||||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd66663db5a988098a89599d4857919b3acf7f61402e61365acfd3919857b9be"
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deranged"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3"
|
||||
dependencies = [
|
||||
"powerfmt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-next"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"dirs-sys-next",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys-next"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
|
@ -76,6 +222,29 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys",
|
||||
"iana-time-zone-haiku",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"windows-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone-haiku"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.8.2"
|
||||
|
@ -85,6 +254,21 @@ dependencies = [
|
|||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kak-tree"
|
||||
version = "0.1.0"
|
||||
|
@ -92,22 +276,99 @@ dependencies = [
|
|||
"clap",
|
||||
"itertools",
|
||||
"serde",
|
||||
"slog",
|
||||
"slog-scope",
|
||||
"sloggers",
|
||||
"toml",
|
||||
"tree-sitter",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.150"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
|
||||
|
||||
[[package]]
|
||||
name = "libflate"
|
||||
version = "0.1.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd"
|
||||
dependencies = [
|
||||
"adler32",
|
||||
"crc32fast",
|
||||
"rle-decode-fast",
|
||||
"take_mut",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
|
||||
dependencies = [
|
||||
"log 0.4.20",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_threads"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
||||
|
||||
[[package]]
|
||||
name = "powerfmt"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.69"
|
||||
|
@ -126,6 +387,26 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libredox",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.2"
|
||||
|
@ -155,6 +436,18 @@ version = "0.8.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
||||
|
||||
[[package]]
|
||||
name = "rle-decode-fast"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422"
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.192"
|
||||
|
@ -172,7 +465,91 @@ checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slog"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8347046d4ebd943127157b94d63abb990fcf729dc4e9978927fdf4ac3c998d06"
|
||||
|
||||
[[package]]
|
||||
name = "slog-async"
|
||||
version = "2.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72c8038f898a2c79507940990f05386455b3a317d8f18d4caea7cbc3d5096b84"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"slog",
|
||||
"take_mut",
|
||||
"thread_local",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slog-kvfilter"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae939ed7d169eed9699f4f5cd440f046f5dc5dfc27c19e3cd311619594c175e0"
|
||||
dependencies = [
|
||||
"regex",
|
||||
"slog",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slog-scope"
|
||||
version = "4.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f95a4b4c3274cd2869549da82b57ccc930859bdbf5bcea0424bc5f140b3c786"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"lazy_static",
|
||||
"slog",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slog-stdlog"
|
||||
version = "3.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1c469573d1e3f36f9eee66cd132206caf47b50c94b1f6c6e7b4d8235e9ecf01"
|
||||
dependencies = [
|
||||
"crossbeam",
|
||||
"log 0.3.9",
|
||||
"slog",
|
||||
"slog-scope",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slog-term"
|
||||
version = "2.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87d29185c55b7b258b4f120eab00f48557d4d9bc814f41713f449d35b0f8977c"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"slog",
|
||||
"term",
|
||||
"thread_local",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sloggers"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31bef221d42166d6708aa1e9b0182324b37a0a7517ff590ec201dbfe1cfa46ef"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"libflate",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"slog",
|
||||
"slog-async",
|
||||
"slog-kvfilter",
|
||||
"slog-scope",
|
||||
"slog-stdlog",
|
||||
"slog-term",
|
||||
"trackable 0.2.24",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -181,6 +558,17 @@ version = "0.8.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.39"
|
||||
|
@ -192,6 +580,23 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "take_mut"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
|
||||
|
||||
[[package]]
|
||||
name = "term"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
|
||||
dependencies = [
|
||||
"dirs-next",
|
||||
"rustversion",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
|
@ -201,6 +606,67 @@ dependencies = [
|
|||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5"
|
||||
dependencies = [
|
||||
"deranged",
|
||||
"itoa",
|
||||
"libc",
|
||||
"num_threads",
|
||||
"powerfmt",
|
||||
"serde",
|
||||
"time-core",
|
||||
"time-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-core"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20"
|
||||
dependencies = [
|
||||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.11"
|
||||
|
@ -210,6 +676,35 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trackable"
|
||||
version = "0.2.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b98abb9e7300b9ac902cc04920945a874c1973e08c310627cc4458c04b70dd32"
|
||||
dependencies = [
|
||||
"trackable 1.3.0",
|
||||
"trackable_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trackable"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b15bd114abb99ef8cee977e517c8f37aee63f184f2d08e3e6ceca092373369ae"
|
||||
dependencies = [
|
||||
"trackable_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trackable_derive"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebeb235c5847e2f82cfe0f07eb971d1e5f6804b18dac2ae16349cc604380f82f"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter"
|
||||
version = "0.20.10"
|
||||
|
@ -238,6 +733,66 @@ version = "0.8.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log 0.4.20",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.39",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.39",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
@ -259,3 +814,69 @@ name = "winapi-x86_64-pc-windows-gnu"
|
|||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.51.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
|
|
@ -8,6 +8,9 @@ edition = "2018"
|
|||
clap = "2.33.0"
|
||||
itertools = "0.8.2"
|
||||
serde = { version = "1.0.104", features = ["derive"] }
|
||||
slog = { version = "2.5.2", features = ["release_max_level_debug"] }
|
||||
slog-scope = "4.3.0"
|
||||
sloggers = "0.3.5"
|
||||
toml = "0.5.6"
|
||||
tree-sitter = "0.20.10"
|
||||
|
||||
|
|
|
@ -19,11 +19,9 @@ map -docstring "disable highlighting" global tree '&' ":tree-always-hig
|
|||
declare-user-mode tree-children
|
||||
declare-user-mode tree-next
|
||||
declare-user-mode tree-prev
|
||||
declare-user-mode tree-quickjump
|
||||
|
||||
map global normal 'f' ":enter-user-mode tree-quickjump<ret>"
|
||||
map global normal 'F' ":enter-user-mode tree-next<ret>"
|
||||
map global normal '<a-f>' ":enter-user-mode tree-children<ret>"
|
||||
map global normal 'f' ":enter-user-mode tree-next<ret>"
|
||||
map global normal 'F' ":enter-user-mode tree-children<ret>"
|
||||
|
||||
evaluate-commands %sh{
|
||||
echo "i,identifier
|
||||
|
@ -39,7 +37,6 @@ while IFS=, read -r cmd group ; do
|
|||
echo "map -docstring '$group child' global tree-children '$cmd' ':tree-select-children $group<ret>'"
|
||||
echo "map -docstring 'next $group' global tree-next '$cmd' ':tree-select-next-node $group<ret>'"
|
||||
echo "map -docstring 'previous $group' global tree-prev '$cmd' ':tree-select-previous-node $group<ret>'"
|
||||
echo "map -docstring 'quickjump to $group' global tree-quickjump '$cmd' ':tree-quickjump $group<ret>'"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ group.arguments = ["arguments", "token_tree", "parameters"]
|
|||
group.statement = ["expression_statement", "let_declaration"]
|
||||
group.string = ["string_literal", "raw_string_literal"]
|
||||
group.number = ["integer_literal", "float_literal", "negative_literal"]
|
||||
group.type = ["abstract_type", "reference_type", "metavariable", "pointer_type", "generic_type", "type_identifier", "scoped_type_identifier", "tuple_type", "unit_type", "array_type", "function_type", "empty_type", "dynamic_type", "bounded_type", "primitive_type"]
|
||||
group.type = ["abstract_type", "reference_type", "metavariable", "pointer_type", "generic_type", "scoped_type_identifier", "tuple_type", "unit_type", "array_type", "function_type", "macro_invocation", "empty_type", "dynamic_type", "bounded_type", "primitive_type"]
|
||||
|
||||
[filetype.python]
|
||||
group.identifier = ["identifier"]
|
||||
|
|
39
rc/tree.kak
39
rc/tree.kak
|
@ -16,15 +16,6 @@ declare-option str tree_highlight_style "black,blue"
|
|||
declare-option -hidden range-specs tree_highlight
|
||||
add-highlighter global/tree_highlight ranges tree_highlight
|
||||
|
||||
declare-option str tree_quickjump_highlight_style "black,green"
|
||||
declare-option -hidden range-specs tree_quickjump_replace
|
||||
add-highlighter global/tree_quickjump_replace replace-ranges tree_quickjump_replace
|
||||
|
||||
declare-option -hidden range-specs tree_quickjump_highlight
|
||||
add-highlighter global/tree_quickjump_highlight ranges tree_quickjump_highlight
|
||||
|
||||
declare-option -hidden range-specs tree_quickjump
|
||||
|
||||
define-command -hidden tree-command -params 1..2 -docstring %{
|
||||
tree-command <OP_TYPE> [<OP_PARAMS>]
|
||||
Send request to kak-tree and evaluate response.
|
||||
|
@ -98,36 +89,6 @@ define-command tree-select-first-child -params ..1 -docstring %{
|
|||
execute-keys ,
|
||||
}
|
||||
|
||||
define-command tree-quickjump -params 1 -docstring %{
|
||||
tree-quickjump [<KIND>]
|
||||
Opens a menu to jump to a node of the specified kind
|
||||
} %{
|
||||
tree-command-with-optional-kind QuickJump %arg{1}
|
||||
|
||||
# We have now set the tree_quickjump variable to contain each location to jump to
|
||||
prompt -menu \
|
||||
-shell-script-candidates 'IFS=" "; for entry in $kak_opt_tree_quickjump ; do echo "${entry#*|}" ; done' "Jump to " \
|
||||
-on-abort %{
|
||||
set-option buffer tree_quickjump "%val{timestamp}"
|
||||
set-option buffer tree_quickjump_highlight "%val{timestamp}"
|
||||
set-option buffer tree_quickjump_replace "%val{timestamp}"
|
||||
} \
|
||||
%{evaluate-commands %sh{
|
||||
# loop through tree_quickjump to find the corresponding selection
|
||||
IFS=" "
|
||||
for entry in $kak_opt_tree_quickjump ; do
|
||||
echo "echo -debug \"testing $entry ($kak_text)\""
|
||||
[ "$entry" = "${entry%|$kak_text}" ] && continue
|
||||
echo "echo -debug \"yes\""
|
||||
echo "select ${entry%|$kak_text}"
|
||||
done
|
||||
echo 'set-option buffer tree_quickjump "%val{timestamp}"'
|
||||
echo 'set-option buffer tree_quickjump_highlight "%val{timestamp}"'
|
||||
echo 'set-option buffer tree_quickjump_replace "%val{timestamp}"'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define-command tree-node-highlight -docstring %{
|
||||
tree-node-highlight
|
||||
Highlight the current node using the tree_highlight_style face
|
||||
|
|
|
@ -10,14 +10,13 @@ pub fn select_ranges(buffer: &[String], ranges: &[Range]) -> String {
|
|||
}
|
||||
|
||||
pub fn highlight_ranges(buffer: &[String], ranges: &[Range]) -> String {
|
||||
format!("set-option buffer tree_highlight %val{{timestamp}} {}", ranges_to_range_desc(&buffer, &ranges, |_i| "%opt{tree_highlight_style}".to_string()))
|
||||
format!("set-option buffer tree_highlight %val{{timestamp}} {}", ranges_to_range_desc(&buffer, &ranges, "%opt{tree_highlight_style}".to_string()))
|
||||
}
|
||||
|
||||
pub fn ranges_to_range_desc<F: Fn(usize) -> String>(buffer: &[String], ranges: &[Range], decorate: F) -> String {
|
||||
pub fn ranges_to_range_desc(buffer: &[String], ranges: &[Range], string: String) -> String {
|
||||
ranges
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, range)| {
|
||||
.map(|range| {
|
||||
let mut end_row = range.end_point.row;
|
||||
let mut end_column = range.end_point.column;
|
||||
if end_column > 0 {
|
||||
|
@ -30,7 +29,7 @@ pub fn ranges_to_range_desc<F: Fn(usize) -> String>(buffer: &[String], ranges: &
|
|||
"\"{},{}|{}\"",
|
||||
point_to_kak_coords(buffer, range.start_point),
|
||||
point_to_kak_coords(buffer, Point::new(end_row, end_column)),
|
||||
decorate(i),
|
||||
string,
|
||||
)
|
||||
})
|
||||
.join(" ")
|
||||
|
@ -114,4 +113,3 @@ fn kak_coords_to_byte_and_point(buffer: &[String], coords: &str) -> (usize, Poin
|
|||
.unwrap();
|
||||
(byte, Point::new(row, column))
|
||||
}
|
||||
|
||||
|
|
19
src/log.rs
Normal file
19
src/log.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use sloggers::terminal::{Destination, TerminalLoggerBuilder};
|
||||
use sloggers::types::Severity;
|
||||
use sloggers::Build;
|
||||
|
||||
pub fn init_global_logger(verbosity: u8) {
|
||||
let level = match verbosity {
|
||||
0 => Severity::Error,
|
||||
1 => Severity::Warning,
|
||||
2 => Severity::Info,
|
||||
3 => Severity::Debug,
|
||||
_ => Severity::Trace,
|
||||
};
|
||||
|
||||
let mut builder = TerminalLoggerBuilder::new();
|
||||
builder.level(level);
|
||||
builder.destination(Destination::Stderr);
|
||||
let logger = builder.build().unwrap();
|
||||
let _guard = slog_scope::set_global_logger(logger);
|
||||
}
|
118
src/main.rs
118
src/main.rs
|
@ -3,14 +3,15 @@ use clap::{crate_version, App, Arg};
|
|||
use serde::Deserialize;
|
||||
use std::io::Read;
|
||||
use toml;
|
||||
use tree_sitter::{Node, Parser, Range, Point};
|
||||
use tree_sitter::{Node, Parser, Range};
|
||||
|
||||
mod config;
|
||||
mod ffi;
|
||||
mod kakoune;
|
||||
mod log;
|
||||
mod tree;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[derive(Deserialize)]
|
||||
struct Request {
|
||||
op: Op,
|
||||
filetype: String,
|
||||
|
@ -18,7 +19,7 @@ struct Request {
|
|||
content: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[derive(Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
enum Op {
|
||||
NodeSExp,
|
||||
|
@ -28,12 +29,14 @@ enum Op {
|
|||
SelectParentNode { kind: Option<String> },
|
||||
SelectPreviousNode { kind: Option<String> },
|
||||
SelectNode,
|
||||
QuickJump { kind: Option<String> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let matches = cli();
|
||||
|
||||
let verbosity = matches.occurrences_of("v") as u8;
|
||||
log::init_global_logger(verbosity);
|
||||
|
||||
if let Some(filetype) = matches.value_of("do-you-understand") {
|
||||
let language = ffi::filetype_to_language(filetype);
|
||||
if let Some(language) = language {
|
||||
|
@ -58,7 +61,6 @@ fn main() {
|
|||
std::io::stdin().read_to_string(&mut request).unwrap();
|
||||
let request: Request = toml::from_str(&request).unwrap();
|
||||
let response = handle_request(&config, &request);
|
||||
eprintln!("(request: {:?})", request);
|
||||
println!("{}", response);
|
||||
}
|
||||
|
||||
|
@ -133,7 +135,7 @@ fn handle_request(config: &Config, request: &Request) -> String {
|
|||
loop {
|
||||
let parent = cursor.parent();
|
||||
loop {
|
||||
if filetype_config.is_node_visible(cursor) && node_of_kinds(cursor, kinds.as_deref()) {
|
||||
if filetype_config.is_node_visible(cursor) && node_of_kinds(cursor, &kinds) {
|
||||
if cursor != node {
|
||||
new_ranges.push(cursor.range());
|
||||
continue 'outer_next;
|
||||
|
@ -198,60 +200,6 @@ fn handle_request(config: &Config, request: &Request) -> String {
|
|||
}
|
||||
kakoune::highlight_ranges(&buffer, &new_ranges)
|
||||
}
|
||||
Op::QuickJump { kind } => {
|
||||
const LETTERS: &[char] = &[
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'å', 'ä', 'ö',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Å', 'Ä', 'Ö',
|
||||
];
|
||||
|
||||
let kind = kind.clone().unwrap();
|
||||
let main_range = &ranges[0];
|
||||
let main_node = tree::shrink_to_range(tree.root_node(), main_range);
|
||||
let kinds = filetype_config.resolve_alias(&kind);
|
||||
|
||||
let mut nodes = next_n_nodes_of_kind(main_node, &kinds, LETTERS.len() / 2, Direction::Forward);
|
||||
nodes.extend(next_n_nodes_of_kind(main_node, &kinds, LETTERS.len() - nodes.len(), Direction::Backward));
|
||||
|
||||
for node in &nodes {
|
||||
new_ranges.push(node.range());
|
||||
}
|
||||
|
||||
// We don't want any ranges that overlap the first char
|
||||
let mut longest_at_point: std::collections::HashMap<Point, usize> = Default::default();
|
||||
for range in &new_ranges {
|
||||
let range_len = range.end_byte - range.start_byte;
|
||||
|
||||
longest_at_point.insert(
|
||||
range.start_point,
|
||||
longest_at_point.get(&range.start_point).copied().unwrap_or(0).max(range_len)
|
||||
);
|
||||
}
|
||||
|
||||
new_ranges.retain(|range| {
|
||||
let range_len = range.end_byte - range.start_byte;
|
||||
range_len >= longest_at_point.get(&range.start_point).copied().unwrap_or(0)
|
||||
});
|
||||
|
||||
eprintln!("ranges = {:?}", new_ranges);
|
||||
|
||||
let new_ranges_first_char: Vec<Range> = new_ranges
|
||||
.iter()
|
||||
.map(|range| Range {
|
||||
start_byte: range.start_byte, end_byte: range.start_byte,
|
||||
start_point: range.start_point,
|
||||
end_point: Point { row: range.start_point.row, column: range.start_point.column + 1 },
|
||||
})
|
||||
.collect();
|
||||
|
||||
let replace_ranges = format!("set-option buffer tree_quickjump_replace %val{{timestamp}} {}", kakoune::ranges_to_range_desc(&buffer, &new_ranges_first_char, |i| LETTERS[i].to_string()));
|
||||
|
||||
let highlight_ranges = format!("set-option buffer tree_quickjump_highlight %val{{timestamp}} {}", kakoune::ranges_to_range_desc(&buffer, &new_ranges_first_char, |_i| "%opt{tree_quickjump_highlight_style}".to_string()));
|
||||
|
||||
let set_option = format!("set-option buffer tree_quickjump %val{{timestamp}} {}", kakoune::ranges_to_range_desc(&buffer, &new_ranges, |i| LETTERS[i].to_string()));
|
||||
|
||||
format!("{replace_ranges} ; {highlight_ranges} ; {set_option}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,55 +245,7 @@ fn find_parent_of_interest<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
enum Direction {
|
||||
Forward, Backward,
|
||||
}
|
||||
|
||||
fn next_n_nodes_of_kind<'a>(node: Node<'a>, kinds: &[String], n: usize, dir: Direction) -> Vec<Node<'a>> {
|
||||
let mut current = node;
|
||||
|
||||
let mut visited = Vec::new();
|
||||
|
||||
'outer: while visited.len() < n {
|
||||
eprintln!("At node kind = {}, {current:?}", node.kind());
|
||||
if kinds.iter().any(|kind| kind == current.kind()) {
|
||||
visited.push(current);
|
||||
}
|
||||
let first_child = match dir {
|
||||
Direction::Forward => current.child(0),
|
||||
Direction::Backward => current.child(current.child_count() - 1),
|
||||
};
|
||||
if let Some(first_child) = first_child {
|
||||
current = first_child;
|
||||
} else {
|
||||
loop {
|
||||
match dir {
|
||||
Direction::Forward => {
|
||||
if let Some(sibling) = current.next_sibling() {
|
||||
current = sibling;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Direction::Backward => {
|
||||
if let Some(sibling) = current.prev_sibling() {
|
||||
current = sibling;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(parent) = current.parent() {
|
||||
current = parent;
|
||||
} else {
|
||||
break 'outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
visited
|
||||
}
|
||||
|
||||
fn node_of_kinds(node: Node, kinds: Option<&[String]>) -> bool {
|
||||
fn node_of_kinds(node: Node, kinds: &Option<Vec<String>>) -> bool {
|
||||
kinds
|
||||
.as_ref()
|
||||
.and_then(|kinds| Some(kinds.iter().any(|x| x == node.kind())))
|
||||
|
|
|
@ -37,4 +37,3 @@ fn highest_node_of_same_range<'a>(current_node: Node<'a>) -> Node<'a> {
|
|||
}
|
||||
node
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user