diff --git a/Cargo.lock b/Cargo.lock index 1579251776b54819fecf5340ee4040708e10eb4d..623ebd982f38f88011e16a863cef53a7b871e23b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,11 +36,11 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" dependencies = [ - "gimli 0.27.2", + "gimli 0.27.3", ] [[package]] @@ -61,7 +61,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -118,7 +118,7 @@ dependencies = [ "settings", "smol", "theme", - "tiktoken-rs 0.4.2", + "tiktoken-rs 0.4.5", "util", "workspace", ] @@ -151,7 +151,7 @@ dependencies = [ "alacritty_config", "alacritty_config_derive", "base64 0.13.1", - "bitflags", + "bitflags 1.3.2", "dirs 4.0.0", "libc", "log", @@ -177,6 +177,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "alsa" version = "0.7.0" @@ -184,7 +190,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8512c9117059663fb5606788fbca3619e2a91dac0e3fe516242eab1fa6be5e44" dependencies = [ "alsa-sys", - "bitflags", + "bitflags 1.3.2", "libc", "nix", ] @@ -205,6 +211,12 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec8ad6edb4840b78c5c3d88de606b22252d552b55f3a4699fbb10fc070ec3049" +[[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" @@ -225,7 +237,7 @@ dependencies = [ "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal 0.4.7", + "is-terminal 0.4.9", "utf8parse", ] @@ -250,7 +262,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -260,14 +272,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "arrayref" @@ -283,9 +295,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "ascii" @@ -306,9 +318,9 @@ dependencies = [ [[package]] name = "async-channel" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", "event-listener", @@ -324,7 +336,7 @@ dependencies = [ "futures-core", "futures-io", "once_cell", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "tokio", ] @@ -338,7 +350,7 @@ dependencies = [ "futures-core", "futures-io", "memchr", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", ] [[package]] @@ -350,7 +362,7 @@ dependencies = [ "async-lock", "async-task", "concurrent-queue", - "fastrand", + "fastrand 1.9.0", "futures-lite", "slab", ] @@ -362,7 +374,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" dependencies = [ "async-lock", - "autocfg 1.1.0", + "autocfg", "blocking", "futures-lite", ] @@ -389,14 +401,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ "async-lock", - "autocfg 1.1.0", + "autocfg", "cfg-if 1.0.0", "concurrent-queue", "futures-lite", "log", "parking", "polling", - "rustix 0.37.19", + "rustix 0.37.23", "slab", "socket2", "waker-fn", @@ -418,7 +430,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4051e67316bc7eff608fe723df5d32ed639946adcd69e07df41fd42a7b411f1f" dependencies = [ "async-io", - "autocfg 1.1.0", + "autocfg", "blocking", "futures-lite", ] @@ -440,14 +452,14 @@ checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" dependencies = [ "async-io", "async-lock", - "autocfg 1.1.0", + "autocfg", "blocking", "cfg-if 1.0.0", "event-listener", "futures-lite", - "rustix 0.37.19", + "rustix 0.37.23", "signal-hook", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -469,7 +481,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -482,7 +494,7 @@ dependencies = [ "async-global-executor", "async-io", "async-lock", - "crossbeam-utils 0.8.15", + "crossbeam-utils", "futures-channel", "futures-core", "futures-io", @@ -492,7 +504,7 @@ dependencies = [ "log", "memchr", "once_cell", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "pin-utils", "slab", "wasm-bindgen-futures", @@ -506,7 +518,7 @@ checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" dependencies = [ "async-stream-impl", "futures-core", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", ] [[package]] @@ -517,7 +529,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -554,13 +566,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -573,7 +585,7 @@ dependencies = [ "futures-io", "futures-util", "log", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "tungstenite 0.16.0", ] @@ -588,12 +600,9 @@ dependencies = [ [[package]] name = "atomic" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" -dependencies = [ - "autocfg 1.1.0", -] +checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" [[package]] name = "atomic-waker" @@ -649,15 +658,6 @@ dependencies = [ "workspace", ] -[[package]] -name = "autocfg" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -673,19 +673,19 @@ dependencies = [ "async-trait", "axum-core", "base64 0.13.1", - "bitflags", + "bitflags 1.3.2", "bytes 1.4.0", "futures-util", "headers", "http", "http-body", "hyper", - "itoa 1.0.6", + "itoa 1.0.9", "matchit", "memchr", "mime", "percent-encoding", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "serde", "serde_json", "serde_urlencoded", @@ -726,7 +726,7 @@ dependencies = [ "futures-util", "http", "mime", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "serde", "serde_json", "tokio", @@ -738,16 +738,16 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" dependencies = [ - "addr2line 0.19.0", + "addr2line 0.20.0", "cc", "cfg-if 1.0.0", "libc", - "miniz_oxide 0.6.2", - "object 0.30.3", + "miniz_oxide 0.7.1", + "object 0.31.1", "rustc-demangle", ] @@ -797,7 +797,7 @@ version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -817,7 +817,7 @@ version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -830,7 +830,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.18", + "syn 2.0.27", "which", ] @@ -855,6 +855,24 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block" version = "0.1.6" @@ -889,7 +907,7 @@ dependencies = [ "async-lock", "async-task", "atomic-waker", - "fastrand", + "fastrand 1.9.0", "futures-lite", "log", ] @@ -980,15 +998,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.2" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c6ed94e98ecff0c12dd1b04c15ec0d7d9458ca8fe806cea6f12954efe74c63b" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "bytecheck" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13fe11640a23eb24562225322cd3e452b93a3d4091d62fab69c70542fcd17d1f" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -997,9 +1015,9 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31225543cb46f81a7e224762764f4a6a0f097b1db0b175f69e8065efaa42de5" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" dependencies = [ "proc-macro2", "quote", @@ -1170,13 +1188,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", "serde", "time 0.1.45", @@ -1207,7 +1225,7 @@ checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" dependencies = [ "glob", "libc", - "libloading", + "libloading 0.7.4", ] [[package]] @@ -1217,7 +1235,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", - "bitflags", + "bitflags 1.3.2", "clap_derive 3.2.25", "clap_lex 0.2.4", "indexmap 1.9.3", @@ -1229,24 +1247,23 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.5" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2686c4115cb0810d9a984776e197823d08ec94f176549a89a9efded477c456dc" +checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" dependencies = [ "clap_builder", - "clap_derive 4.3.2", + "clap_derive 4.3.12", "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.5" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e53afce1efce6ed1f633cf0e57612fe51db54a1ee4fd8f8503d078fe02d69ae" +checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex 0.5.0", "strsim", ] @@ -1266,14 +1283,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.2" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -1340,11 +1357,11 @@ dependencies = [ "sum_tree", "tempfile", "thiserror", - "time 0.3.21", + "time 0.3.23", "tiny_http", "url", "util", - "uuid 1.3.2", + "uuid 1.4.1", ] [[package]] @@ -1368,7 +1385,7 @@ name = "cocoa" version = "0.24.0" source = "git+https://github.com/servo/core-foundation-rs?rev=079665882507dd5e2ff77db3de5070c1f6c0fb85#079665882507dd5e2ff77db3de5070c1f6c0fb85" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "cocoa-foundation", "core-foundation", @@ -1383,7 +1400,7 @@ name = "cocoa-foundation" version = "0.1.1" source = "git+https://github.com/servo/core-foundation-rs?rev=079665882507dd5e2ff77db3de5070c1f6c0fb85#079665882507dd5e2ff77db3de5070c1f6c0fb85" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "core-foundation", "core-graphics-types", @@ -1392,16 +1409,6 @@ dependencies = [ "objc", ] -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - [[package]] name = "collab" version = "0.16.0" @@ -1452,7 +1459,7 @@ dependencies = [ "sha-1 0.9.8", "sqlx", "theme", - "time 0.3.21", + "time 0.3.23", "tokio", "tokio-tungstenite", "toml", @@ -1554,7 +1561,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" dependencies = [ - "crossbeam-utils 0.8.15", + "crossbeam-utils", ] [[package]] @@ -1645,7 +1652,7 @@ name = "core-graphics" version = "0.22.3" source = "git+https://github.com/servo/core-foundation-rs?rev=079665882507dd5e2ff77db3de5070c1f6c0fb85#079665882507dd5e2ff77db3de5070c1f6c0fb85" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-graphics-types", "foreign-types", @@ -1657,7 +1664,7 @@ name = "core-graphics-types" version = "0.1.1" source = "git+https://github.com/servo/core-foundation-rs?rev=079665882507dd5e2ff77db3de5070c1f6c0fb85#079665882507dd5e2ff77db3de5070c1f6c0fb85" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "foreign-types", "libc", @@ -1690,7 +1697,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb17e2d1795b1996419648915df94bc7103c28f7b48062d7acf4652fc371b2ff" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation-sys 0.6.2", "coreaudio-sys", ] @@ -1740,9 +1747,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -1867,16 +1874,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "crossbeam-channel" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" -dependencies = [ - "crossbeam-utils 0.7.2", - "maybe-uninit", -] - [[package]] name = "crossbeam-channel" version = "0.5.8" @@ -1884,7 +1881,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.15", + "crossbeam-utils", ] [[package]] @@ -1895,19 +1892,19 @@ checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ "cfg-if 1.0.0", "crossbeam-epoch", - "crossbeam-utils 0.8.15", + "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ - "autocfg 1.1.0", + "autocfg", "cfg-if 1.0.0", - "crossbeam-utils 0.8.15", - "memoffset 0.8.0", + "crossbeam-utils", + "memoffset 0.9.0", "scopeguard", ] @@ -1918,25 +1915,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.15", + "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.7.2" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg 1.1.0", - "cfg-if 0.1.10", - "lazy_static", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if 1.0.0", ] @@ -1988,9 +1974,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.61+curl-8.0.1" +version = "0.4.64+curl-8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d05c10f541ae6f3bc5b3d923c20001f47db7d5f0b2bc6ad16490133842db79" +checksum = "f96069f0b1cb1241c838740659a771ef143363f52772a9ce1bd9c04c75eee0dc" dependencies = [ "cc", "libc", @@ -2001,61 +1987,17 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "cxx" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.18", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - [[package]] name = "dashmap" -version = "5.4.0" +version = "5.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +checksum = "6943ae99c34386c84a470c499d3414f66502a41340aa895406e0d2e4a207b91d" dependencies = [ "cfg-if 1.0.0", - "hashbrown 0.12.3", + "hashbrown 0.14.0", "lock_api", "once_cell", - "parking_lot_core 0.9.7", + "parking_lot_core 0.9.8", ] [[package]] @@ -2160,9 +2102,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", "crypto-common", @@ -2231,11 +2173,11 @@ dependencies = [ [[package]] name = "dlib" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" +checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading", + "libloading 0.8.0", ] [[package]] @@ -2266,9 +2208,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "304e6508efa593091e97a9abbc10f90aa7ca635b6d2784feff3c89d41dd12272" [[package]] name = "editor" @@ -2316,7 +2258,7 @@ dependencies = [ "tree-sitter", "tree-sitter-html", "tree-sitter-rust", - "tree-sitter-typescript", + "tree-sitter-typescript 0.20.2 (git+https://github.com/tree-sitter/tree-sitter-typescript?rev=5d20856f34315b068c41edaee2ac8a100081d259)", "unindent", "util", "workspace", @@ -2324,9 +2266,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "encoding_rs" @@ -2357,7 +2299,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" dependencies = [ "humantime", - "is-terminal 0.4.7", + "is-terminal 0.4.9", "log", "regex", "termcolor", @@ -2374,15 +2316,15 @@ dependencies = [ [[package]] name = "equivalent" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2b0c2380453a92ea8b6c8e5f64ecaafccddde8ceab55ff7a8ac1029f894569" +checksum = "da96524cc884f6558f1769b6c46686af2fe8e8b4cd253bd5a3cdba8181b8e070" dependencies = [ "serde", ] @@ -2406,7 +2348,7 @@ checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -2421,9 +2363,9 @@ dependencies = [ [[package]] name = "etagere" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6301151a318f367f392c31395beb1cfba5ccd9abc44d1db0db3a4b27b9601c89" +checksum = "fcf22f748754352918e082e0039335ee92454a5d62bcaf69b5e8daf5907d9644" dependencies = [ "euclid", "svg_fmt", @@ -2475,6 +2417,12 @@ dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + [[package]] name = "feedback" version = "0.1.0" @@ -2546,7 +2494,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall 0.2.16", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -2600,7 +2548,7 @@ name = "font-kit" version = "0.11.0" source = "git+https://github.com/zed-industries/font-kit?rev=b2f77d56f450338aa4f7dd2f0197d8c9acb0cf18#b2f77d56f450338aa4f7dd2f0197d8c9acb0cf18" dependencies = [ - "bitflags", + "bitflags 1.3.2", "byteorder", "core-foundation", "core-graphics", @@ -2647,9 +2595,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -2700,7 +2648,7 @@ dependencies = [ "smol", "sum_tree", "tempfile", - "time 0.3.21", + "time 0.3.23", "util", ] @@ -2719,7 +2667,7 @@ dependencies = [ name = "fsevent" version = "2.0.2" dependencies = [ - "bitflags", + "bitflags 1.3.2", "fsevent-sys", "parking_lot 0.11.2", "tempdir", @@ -2746,7 +2694,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" dependencies = [ - "bitflags", + "bitflags 1.3.2", "fuchsia-zircon-sys", ] @@ -2756,6 +2704,12 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures" version = "0.1.31" @@ -2827,12 +2781,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", "parking", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "waker-fn", ] @@ -2844,7 +2798,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -2873,7 +2827,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "pin-utils", "slab", "tokio-io", @@ -2919,9 +2873,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if 1.0.0", "libc", @@ -2951,9 +2905,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "git" @@ -2981,7 +2935,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2994bee4a3a6a51eb90c218523be382fd7ea09b16380b9312e9dbe955ff7c7d1" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "libgit2-sys", "log", @@ -2996,11 +2950,11 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +checksum = "1391ab1f92ffcc08911957149833e682aa3fe252b9f45f966d2ef972274c97df" dependencies = [ - "aho-corasick 0.7.20", + "aho-corasick 1.0.2", "bstr", "fnv", "log", @@ -3084,11 +3038,11 @@ dependencies = [ "smol", "sqlez", "sum_tree", - "time 0.3.21", + "time 0.3.23", "tiny-skia", "usvg", "util", - "uuid 1.3.2", + "uuid 1.4.1", "waker-fn", ] @@ -3103,9 +3057,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.18" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" dependencies = [ "bytes 1.4.0", "fnv", @@ -3152,6 +3106,10 @@ name = "hashbrown" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +dependencies = [ + "ahash 0.8.3", + "allocator-api2", +] [[package]] name = "hashlink" @@ -3164,11 +3122,11 @@ dependencies = [ [[package]] name = "hashlink" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" +checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f" dependencies = [ - "hashbrown 0.12.3", + "hashbrown 0.14.0", ] [[package]] @@ -3178,7 +3136,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" dependencies = [ "base64 0.13.1", - "bitflags", + "bitflags 1.3.2", "bytes 1.4.0", "headers-core", "http", @@ -3234,9 +3192,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "hex" @@ -3269,7 +3227,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -3286,7 +3244,7 @@ checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes 1.4.0", "fnv", - "itoa 1.0.6", + "itoa 1.0.9", ] [[package]] @@ -3297,14 +3255,14 @@ checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes 1.4.0", "http", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", ] [[package]] name = "http-range-header" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" +checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" [[package]] name = "httparse" @@ -3332,9 +3290,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.26" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes 1.4.0", "futures-channel", @@ -3345,8 +3303,8 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.6", - "pin-project-lite 0.2.9", + "itoa 1.0.9", + "pin-project-lite 0.2.10", "socket2", "tokio", "tower-service", @@ -3361,7 +3319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ "hyper", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "tokio", "tokio-io-timeout", ] @@ -3381,9 +3339,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys 0.8.3", @@ -3395,19 +3353,18 @@ dependencies = [ [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -3455,7 +3412,7 @@ version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ - "autocfg 1.1.0", + "autocfg", "hashbrown 0.12.3", "serde", ] @@ -3518,13 +3475,13 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi 0.3.2", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -3538,12 +3495,12 @@ dependencies = [ [[package]] name = "ipc-channel" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cb1d9211085f0ea6f1379d944b93c4d07e8207aa3bcf49f37eda12b85081887" +checksum = "342d636452fbc2895574e0b319b23c014fd01c9ed71dcd87f6a4a8e2f948db4b" dependencies = [ "bincode", - "crossbeam-channel 0.4.4", + "crossbeam-channel", "fnv", "lazy_static", "libc", @@ -3551,15 +3508,15 @@ dependencies = [ "rand 0.7.3", "serde", "tempfile", - "uuid 0.8.2", + "uuid 1.4.1", "winapi 0.3.9", ] [[package]] name = "ipnet" -version = "2.7.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" @@ -3575,14 +3532,13 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes 1.0.10", - "rustix 0.37.19", - "windows-sys 0.48.0", + "hermit-abi 0.3.2", + "rustix 0.38.4", + "windows-sys", ] [[package]] @@ -3593,7 +3549,7 @@ checksum = "334e04b4d781f436dc315cb1e7515bd96826426345d498149e4bde36b67f8ee9" dependencies = [ "async-channel", "castaway", - "crossbeam-utils 0.8.15", + "crossbeam-utils", "curl", "curl-sys", "encoding_rs", @@ -3629,9 +3585,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "ittapi-rs" @@ -3714,9 +3670,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.62" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c16e1bfd491478ab155fd8b4896b86f9ede344949b641e61501e07c2b8b4d5" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -3729,11 +3685,11 @@ checksum = "6204285f77fe7d9784db3fdc449ecce1a0114927a51d5a41c4c7a292011c015f" dependencies = [ "base64 0.13.1", "crypto-common", - "digest 0.10.6", + "digest 0.10.7", "hmac 0.12.1", "serde", "serde_json", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -3752,7 +3708,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a53776d271cfb873b17c618af0298445c88afc52837f3e948fa3fafd131f449" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", ] [[package]] @@ -3803,7 +3759,7 @@ dependencies = [ "text", "theme", "tree-sitter", - "tree-sitter-elixir", + "tree-sitter-elixir 0.1.0 (git+https://github.com/elixir-lang/tree-sitter-elixir?rev=4ba9dab6e2602960d95b2b625f3386c27e08084e)", "tree-sitter-embedded-template", "tree-sitter-heex", "tree-sitter-html", @@ -3812,7 +3768,7 @@ dependencies = [ "tree-sitter-python", "tree-sitter-ruby", "tree-sitter-rust", - "tree-sitter-typescript", + "tree-sitter-typescript 0.20.2 (git+https://github.com/tree-sitter/tree-sitter-typescript?rev=5d20856f34315b068c41edaee2ac8a100081d259)", "unicase", "unindent", "util", @@ -3892,9 +3848,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.144" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libgit2-sys" @@ -3918,11 +3874,21 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "libloading" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb" +dependencies = [ + "cfg-if 1.0.0", + "windows-sys", +] + [[package]] name = "libm" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "libsqlite3-sys" @@ -3937,9 +3903,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.9" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" dependencies = [ "cc", "libc", @@ -3956,15 +3922,6 @@ dependencies = [ "safemem", ] -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - [[package]] name = "linked-hash-map" version = "0.5.6" @@ -3979,9 +3936,15 @@ checksum = "5284f00d480e1c39af34e72f8ad60b94f47007e3481cd3b731c1d67190ddc7b7" [[package]] name = "linux-raw-sys" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + +[[package]] +name = "linux-raw-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" [[package]] name = "lipsum" @@ -4022,7 +3985,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "sha2 0.10.6", + "sha2 0.10.7", "simplelog", ] @@ -4042,26 +4005,25 @@ dependencies = [ "reqwest", "serde", "serde_derive", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ - "autocfg 1.1.0", + "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" dependencies = [ - "cfg-if 1.0.0", "serde", "value-bag", ] @@ -4095,7 +4057,7 @@ version = "0.94.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b63735a13a1f9cd4f4835223d828ed9c2e35c8c5e61837774399f558b6a1237" dependencies = [ - "bitflags", + "bitflags 1.3.2", "serde", "serde_json", "serde_repr", @@ -4156,7 +4118,7 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "090126dc04f95dc0d1c1c91f61bdd474b3930ca064c1edc8a849da2c6cbe1e77" dependencies = [ - "autocfg 1.1.0", + "autocfg", "rawpointer", ] @@ -4166,19 +4128,13 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "md-5" version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" dependencies = [ - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -4225,16 +4181,16 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ - "autocfg 1.1.0", + "autocfg", ] [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ - "autocfg 1.1.0", + "autocfg", ] [[package]] @@ -4250,7 +4206,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4598d719460ade24c7d91f335daf055bf2a7eec030728ce751814c50cdd6a26c" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "cocoa-foundation", "foreign-types", @@ -4286,16 +4242,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" dependencies = [ "adler", - "autocfg 1.1.0", -] - -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", + "autocfg", ] [[package]] @@ -4338,14 +4285,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -4450,7 +4396,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "jni-sys", "ndk-sys", "num_enum", @@ -4475,9 +4421,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.38" +version = "0.2.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" +checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" dependencies = [ "cfg-if 0.1.10", "libc", @@ -4490,7 +4436,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "libc", "memoffset 0.6.5", @@ -4558,18 +4504,17 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ - "autocfg 1.1.0", + "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-bigint-dig" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4547ee5541c18742396ae2c895d0717d0f886d8823b8399cdaf7b07d63ad0480" +checksum = "f9bc3e36fd683e004fd59c64a425e0e991616f5a8b617c3b9a933a93c168facc" dependencies = [ - "autocfg 0.1.8", "byteorder", "lazy_static", "libm", @@ -4598,7 +4543,7 @@ version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "autocfg 1.1.0", + "autocfg", "num-traits", ] @@ -4608,7 +4553,7 @@ version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ - "autocfg 1.1.0", + "autocfg", "num-integer", "num-traits", ] @@ -4619,28 +4564,28 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ - "autocfg 1.1.0", + "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ - "autocfg 1.1.0", + "autocfg", "libm", ] [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.2", "libc", ] @@ -4713,9 +4658,9 @@ dependencies = [ [[package]] name = "object" -version = "0.30.3" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" dependencies = [ "memchr", ] @@ -4754,9 +4699,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -4766,11 +4711,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.52" +version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56" +checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "foreign-types", "libc", @@ -4787,7 +4732,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -4798,9 +4743,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.87" +version = "0.9.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e" +checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" dependencies = [ "cc", "libc", @@ -4819,9 +4764,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.5.0" +version = "6.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" +checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" [[package]] name = "ouroboros" @@ -4864,15 +4809,6 @@ dependencies = [ "workspace", ] -[[package]] -name = "output_vt100" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "overload" version = "0.1.1" @@ -4917,7 +4853,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.7", + "parking_lot_core 0.9.8", ] [[package]] @@ -4936,15 +4872,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.48.1", ] [[package]] @@ -4960,9 +4896,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pathfinder_color" @@ -5020,15 +4956,15 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.6.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" +checksum = "0d2d1d55045829d65aad9d389139882ad623b33b904e7c9f1b10c5b8927298e5" dependencies = [ "thiserror", "ucd-trie", @@ -5069,22 +5005,22 @@ checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.27", ] [[package]] @@ -5095,9 +5031,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" [[package]] name = "pin-utils" @@ -5113,16 +5049,16 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "plist" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" +checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" dependencies = [ "base64 0.21.2", "indexmap 1.9.3", "line-wrap", "quick-xml", "serde", - "time 0.3.21", + "time 0.3.23", ] [[package]] @@ -5169,7 +5105,7 @@ version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crc32fast", "deflate", "miniz_oxide 0.3.7", @@ -5181,14 +5117,14 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ - "autocfg 1.1.0", - "bitflags", + "autocfg", + "bitflags 1.3.2", "cfg-if 1.0.0", "concurrent-queue", "libc", "log", - "pin-project-lite 0.2.9", - "windows-sys 0.48.0", + "pin-project-lite 0.2.10", + "windows-sys", ] [[package]] @@ -5222,24 +5158,22 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "pretty_assertions" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a25e9bcb20aa780fd0bb16b72403a9064d6b3f22f026946029acb941a50af755" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" dependencies = [ - "ctor", "diff", - "output_vt100", "yansi", ] [[package]] name = "prettyplease" -version = "0.2.6" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b69d39aab54d069e7f2fe8cb970493e7834601ca2d8c65fd7bbd183578080d1" +checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" dependencies = [ "proc-macro2", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -5287,9 +5221,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -5345,7 +5279,7 @@ dependencies = [ "serde_derive", "serde_json", "settings", - "sha2 0.10.6", + "sha2 0.10.7", "similar", "smol", "sum_tree", @@ -5548,33 +5482,39 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63" +checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" dependencies = [ - "bitflags", + "bitflags 1.3.2", "memchr", "unicase", ] [[package]] name = "quick-xml" -version = "0.28.2" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.4.6" @@ -5662,7 +5602,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -5702,9 +5642,9 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" dependencies = [ - "crossbeam-channel 0.5.8", + "crossbeam-channel", "crossbeam-deque", - "crossbeam-utils 0.8.15", + "crossbeam-utils", "num_cpus", ] @@ -5750,7 +5690,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -5759,7 +5699,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -5768,7 +5708,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "redox_syscall 0.2.16", "thiserror", ] @@ -5787,13 +5727,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.1" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ - "aho-corasick 1.0.1", + "aho-corasick 1.0.2", "memchr", - "regex-syntax 0.7.1", + "regex-automata 0.3.3", + "regex-syntax 0.7.4", ] [[package]] @@ -5810,6 +5751,11 @@ name = "regex-automata" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" +dependencies = [ + "aho-corasick 1.0.2", + "memchr", + "regex-syntax 0.7.4", +] [[package]] name = "regex-syntax" @@ -5819,9 +5765,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "region" @@ -5829,7 +5775,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "mach", "winapi 0.3.9", @@ -5855,9 +5801,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.17" +version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ "base64 0.21.2", "bytes 1.4.0", @@ -5876,7 +5822,7 @@ dependencies = [ "native-tls", "once_cell", "percent-encoding", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "serde", "serde_json", "serde_urlencoded", @@ -5932,23 +5878,26 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.41" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21499ed91807f07ae081880aabb2ccc0235e9d88011867d984525e9a4c3cfa3e" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" dependencies = [ + "bitvec", "bytecheck", "hashbrown 0.12.3", "ptr_meta", "rend", "rkyv_derive", "seahash", + "tinyvec", + "uuid 1.4.1", ] [[package]] name = "rkyv_derive" -version = "0.7.41" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1c672430eb41556291981f45ca900a0239ad007242d1cb4b4167af842db666" +checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" dependencies = [ "proc-macro2", "quote", @@ -5957,9 +5906,9 @@ dependencies = [ [[package]] name = "rmp" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44519172358fd6d58656c86ab8e7fbc9e1490c3e8f14d35ed78ca0dd07403c9f" +checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" dependencies = [ "byteorder", "num-traits", @@ -5968,9 +5917,9 @@ dependencies = [ [[package]] name = "rmpv" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de8813b3a2f95c5138fe5925bfb8784175d88d6bff059ba8ce090aa891319754" +checksum = "2e0e0214a4a2b444ecce41a4025792fc31f77c7bb89c46d253953ea8c65701ec" dependencies = [ "num-traits", "rmp", @@ -5993,7 +5942,7 @@ dependencies = [ name = "rope" version = "0.1.0" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "bromberg_sl2", "gpui", "log", @@ -6067,7 +6016,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85127183a999f7db96d1a976a309eebbfb6ea3b0b400ddd8340190129de6eb7a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "fallible-iterator", "fallible-streaming-iterator", "hashlink 0.7.0", @@ -6078,9 +6027,9 @@ dependencies = [ [[package]] name = "rust-embed" -version = "6.6.1" +version = "6.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b68543d5527e158213414a92832d2aab11a84d2571a5eb021ebe22c43aab066" +checksum = "a36224c3276f8c4ebc8c20f158eca7ca4359c8db89991c4925132aaaf6702661" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -6089,35 +6038,35 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "6.5.0" +version = "6.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4e0f0ced47ded9a68374ac145edd65a6c1fa13a96447b873660b2a568a0fd7" +checksum = "49b94b81e5b2c284684141a2fb9e2a31be90638caf040bf9afbc5a0416afe1ac" dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 1.0.109", + "syn 2.0.27", "walkdir", ] [[package]] name = "rust-embed-utils" -version = "7.5.0" +version = "7.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512b0ab6853f7e14e3c8754acb43d6f748bb9ced66aa5915a6553ac8213f7731" +checksum = "9d38ff6bf570dc3bb7100fce9f7b60c33fa71d80e88da3f2580df4ff2bdded74" dependencies = [ "globset", - "sha2 0.10.6", + "sha2 0.10.7", "walkdir", ] [[package]] name = "rust_decimal" -version = "1.29.1" +version = "1.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26bd36b60561ee1fb5ec2817f198b6fd09fa571c897a5e86d1487cfc2b096dfc" +checksum = "d0446843641c69436765a35a5a77088e28c2e6a12da93e84aa3ab1cd4aa5a042" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "borsh", "bytecheck", "byteorder", @@ -6156,10 +6105,10 @@ version = "0.33.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "938a344304321a9da4973b9ff4f9f8db9caf4597dfd9dda6a60b523340a0fff0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno 0.2.8", "io-lifetimes 0.5.3", - "itoa 1.0.6", + "itoa 1.0.9", "libc", "linux-raw-sys 0.0.42", "once_cell", @@ -6168,16 +6117,29 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" +dependencies = [ + "bitflags 1.3.2", + "errno 0.3.1", + "io-lifetimes 1.0.11", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys", +] + +[[package]] +name = "rustix" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" dependencies = [ - "bitflags", + "bitflags 2.3.3", "errno 0.3.1", - "io-lifetimes 1.0.10", "libc", - "linux-raw-sys 0.3.7", - "windows-sys 0.48.0", + "linux-raw-sys 0.4.3", + "windows-sys", ] [[package]] @@ -6207,18 +6169,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ "base64 0.21.2", ] [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rustybuzz" @@ -6226,7 +6188,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab463a295d00f3692e0974a0bfd83c7a9bcd119e27e07c2beecdb1b44a09d10" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bytemuck", "smallvec", "ttf-parser 0.9.0", @@ -6238,9 +6200,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "safe_arch" @@ -6277,11 +6239,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -6316,15 +6278,9 @@ checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" [[package]] name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "scratch" -version = "1.0.5" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scrypt" @@ -6381,10 +6337,10 @@ dependencies = [ "serde_json", "sqlx", "thiserror", - "time 0.3.21", + "time 0.3.23", "tracing", "url", - "uuid 1.3.2", + "uuid 1.4.1", ] [[package]] @@ -6409,8 +6365,8 @@ dependencies = [ "rust_decimal", "sea-query-derive", "serde_json", - "time 0.3.21", - "uuid 1.3.2", + "time 0.3.23", + "uuid 1.4.1", ] [[package]] @@ -6424,8 +6380,8 @@ dependencies = [ "sea-query", "serde_json", "sqlx", - "time 0.3.21", - "uuid 1.3.2", + "time 0.3.23", + "uuid 1.4.1", ] [[package]] @@ -6474,7 +6430,7 @@ name = "search" version = "0.1.0" dependencies = [ "anyhow", - "bitflags", + "bitflags 1.3.2", "client", "collections", "editor", @@ -6486,6 +6442,7 @@ dependencies = [ "menu", "postage", "project", + "semantic_index", "serde", "serde_derive", "serde_json", @@ -6500,11 +6457,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.8.2" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys 0.8.3", "libc", @@ -6513,14 +6470,60 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys 0.8.3", "libc", ] +[[package]] +name = "semantic_index" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "bincode", + "ctor", + "editor", + "env_logger 0.9.3", + "futures 0.3.28", + "globset", + "gpui", + "isahc", + "language", + "lazy_static", + "log", + "matrixmultiply", + "parking_lot 0.11.2", + "picker", + "postage", + "pretty_assertions", + "project", + "rand 0.8.5", + "rpc", + "rusqlite", + "schemars", + "serde", + "serde_json", + "settings", + "smol", + "tempdir", + "theme", + "tiktoken-rs 0.5.0", + "tree-sitter", + "tree-sitter-cpp", + "tree-sitter-elixir 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tree-sitter-json 0.19.0", + "tree-sitter-rust", + "tree-sitter-toml 0.20.0", + "tree-sitter-typescript 0.20.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unindent", + "util", + "workspace", +] + [[package]] name = "semver" version = "0.11.0" @@ -6547,22 +6550,22 @@ checksum = "5a9f47faea3cad316faa914d013d24f471cd90bfca1a0c70f05a3f42c6441e99" [[package]] name = "serde" -version = "1.0.162" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6" +checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.162" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6" +checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -6587,12 +6590,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ - "indexmap 1.9.3", - "itoa 1.0.6", + "indexmap 2.0.0", + "itoa 1.0.9", "ryu", "serde", ] @@ -6611,13 +6614,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.12" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" +checksum = "e168eaaf71e8f9bd6037feb05190485708e019f4fd87d161b3c0a0d37daf85e5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -6627,7 +6630,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.6", + "itoa 1.0.9", "ryu", "serde", ] @@ -6694,7 +6697,7 @@ checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -6705,7 +6708,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -6723,13 +6726,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest 0.10.6", + "digest 0.10.7", ] [[package]] @@ -6758,9 +6761,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "signal-hook" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" dependencies = [ "libc", "signal-hook-registry", @@ -6843,7 +6846,7 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ - "autocfg 1.1.0", + "autocfg", ] [[package]] @@ -6865,9 +6868,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "smol" @@ -6947,7 +6950,7 @@ dependencies = [ "parking_lot 0.11.2", "smol", "thread_local", - "uuid 1.3.2", + "uuid 1.4.1", ] [[package]] @@ -6992,7 +6995,7 @@ dependencies = [ "ahash 0.7.6", "atoi", "base64 0.13.1", - "bitflags", + "bitflags 1.3.2", "byteorder", "bytes 1.4.0", "chrono", @@ -7008,12 +7011,12 @@ dependencies = [ "futures-executor", "futures-intrusive", "futures-util", - "hashlink 0.8.1", + "hashlink 0.8.3", "hex", "hkdf", "hmac 0.12.1", "indexmap 1.9.3", - "itoa 1.0.6", + "itoa 1.0.9", "libc", "libsqlite3-sys", "log", @@ -7030,16 +7033,16 @@ dependencies = [ "serde", "serde_json", "sha1", - "sha2 0.10.6", + "sha2 0.10.7", "smallvec", "sqlformat", "sqlx-rt", "stringprep", "thiserror", - "time 0.3.21", + "time 0.3.23", "tokio-stream", "url", - "uuid 1.3.2", + "uuid 1.4.1", "webpki-roots 0.22.6", "whoami", ] @@ -7057,7 +7060,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "sha2 0.10.6", + "sha2 0.10.7", "sqlx-core", "sqlx-rt", "syn 1.0.109", @@ -7097,9 +7100,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stringprep" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" +checksum = "db3737bde7edce97102e0e2b15365bf7a20bfdb5f60f4f9e8d7004258a51a8da" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -7121,7 +7124,7 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" name = "sum_tree" version = "0.1.0" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "ctor", "env_logger 0.9.3", "log", @@ -7130,11 +7133,70 @@ dependencies = [ [[package]] name = "sval" -version = "1.0.0-alpha.5" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45f6ee7c7b87caf59549e9fe45d6a69c75c8019e79e212a835c5da0e92f0ba08" +checksum = "8b031320a434d3e9477ccf9b5756d57d4272937b8d22cb88af80b7633a1b78b1" + +[[package]] +name = "sval_buffer" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bf7e9412af26b342f3f2cc5cc4122b0105e9d16eb76046cd14ed10106cf6028" +dependencies = [ + "sval", + "sval_ref", +] + +[[package]] +name = "sval_dynamic" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0ef628e8a77a46ed3338db8d1b08af77495123cc229453084e47cd716d403cf" +dependencies = [ + "sval", +] + +[[package]] +name = "sval_fmt" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dc09e9364c2045ab5fa38f7b04d077b3359d30c4c2b3ec4bae67a358bd64326" +dependencies = [ + "itoa 1.0.9", + "ryu", + "sval", +] + +[[package]] +name = "sval_json" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ada6f627e38cbb8860283649509d87bc4a5771141daa41c78fd31f2b9485888d" +dependencies = [ + "itoa 1.0.9", + "ryu", + "sval", +] + +[[package]] +name = "sval_ref" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703ca1942a984bd0d9b5a4c0a65ab8b4b794038d080af4eb303c71bc6bf22d7c" +dependencies = [ + "sval", +] + +[[package]] +name = "sval_serde" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830926cd0581f7c3e5d51efae4d35c6b6fc4db583842652891ba2f1bed8db046" dependencies = [ "serde", + "sval", + "sval_buffer", + "sval_fmt", ] [[package]] @@ -7181,7 +7243,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f31d7fece546f1e6973011a9eceae948133bbd18fd3d52f6073b1e38ae6368a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "lazy_static", "log", "symphonia-core", @@ -7194,8 +7256,8 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7c73eb88fee79705268cc7b742c7bc93a7b76e092ab751d0833866970754142" dependencies = [ - "arrayvec 0.7.2", - "bitflags", + "arrayvec 0.7.4", + "bitflags 1.3.2", "bytemuck", "lazy_static", "log", @@ -7226,9 +7288,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" dependencies = [ "proc-macro2", "quote", @@ -7273,7 +7335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e09bb3fb4e02ec4b87e182ea9718fadbc0fa3e50085b40a9af9690572b67f9e" dependencies = [ "atty", - "bitflags", + "bitflags 1.3.2", "cap-fs-ext", "cap-std", "io-lifetimes 0.5.3", @@ -7288,11 +7350,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bdb6fa0dfa67b38c1e66b7041ba9dcf23b99d8121907cd31c807a332f7a0bbb" +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "target-lexicon" -version = "0.12.7" +version = "0.12.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" +checksum = "1d2faeef5759ab89935255b1a4cd98e0baf99d1085e37d36599c625dac49ae8e" [[package]] name = "tempdir" @@ -7306,15 +7374,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" dependencies = [ "cfg-if 1.0.0", - "fastrand", + "fastrand 2.0.0", "redox_syscall 0.3.5", - "rustix 0.37.19", - "windows-sys 0.45.0", + "rustix 0.38.4", + "windows-sys", ] [[package]] @@ -7460,22 +7528,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -7507,9 +7575,9 @@ dependencies = [ [[package]] name = "tiktoken-rs" -version = "0.4.2" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ba161c549e2c0686f35f5d920e63fad5cafba2c28ad2caceaf07e5d9fa6e8c4" +checksum = "52aacc1cff93ba9d5f198c62c49c77fa0355025c729eed3326beaf7f33bc8614" dependencies = [ "anyhow", "base64 0.21.2", @@ -7548,11 +7616,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" dependencies = [ - "itoa 1.0.6", + "itoa 1.0.9", "serde", "time-core", "time-macros", @@ -7566,9 +7634,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" +checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" dependencies = [ "time-core", ] @@ -7617,21 +7685,22 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.1" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ - "autocfg 1.1.0", + "autocfg", + "backtrace", "bytes 1.4.0", "libc", - "mio 0.8.6", + "mio 0.8.8", "num_cpus", "parking_lot 0.12.1", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -7651,7 +7720,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" dependencies = [ - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "tokio", ] @@ -7663,7 +7732,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -7694,7 +7763,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "tokio", ] @@ -7720,7 +7789,7 @@ dependencies = [ "futures-core", "futures-sink", "log", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "tokio", ] @@ -7734,7 +7803,7 @@ dependencies = [ "futures-core", "futures-io", "futures-sink", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "tokio", "tracing", ] @@ -7756,9 +7825,9 @@ checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.11" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ "indexmap 2.0.0", "toml_datetime", @@ -7806,7 +7875,7 @@ dependencies = [ "futures-util", "indexmap 1.9.3", "pin-project", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "rand 0.8.5", "slab", "tokio", @@ -7822,14 +7891,14 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bytes 1.4.0", "futures-core", "futures-util", "http", "http-body", "http-range-header", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "tower", "tower-layer", "tower-service", @@ -7855,27 +7924,27 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite 0.2.9", + "pin-project-lite 0.2.10", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", "valuable", @@ -7936,7 +8005,7 @@ dependencies = [ [[package]] name = "tree-sitter" version = "0.20.10" -source = "git+https://github.com/tree-sitter/tree-sitter?rev=49226023693107fba9a1191136a4f47f38cdca73#49226023693107fba9a1191136a4f47f38cdca73" +source = "git+https://github.com/tree-sitter/tree-sitter?rev=1c65ca24bc9a734ab70115188f465e12eecf224e#1c65ca24bc9a734ab70115188f465e12eecf224e" dependencies = [ "cc", "regex", @@ -7953,9 +8022,9 @@ dependencies = [ [[package]] name = "tree-sitter-c" -version = "0.20.2" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cca211f4827d4b4dc79f388bf67b6fa3bc8a8cfa642161ef24f99f371ba34c7b" +checksum = "fa1bb73a4101c88775e4fefcd0543ee25e192034484a5bd45cb99eefb997dca9" dependencies = [ "cc", "tree-sitter", @@ -7963,9 +8032,9 @@ dependencies = [ [[package]] name = "tree-sitter-cpp" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a869e3c5cef4e5db4e9ab16a8dc84d73010e60ada14cdc60d2f6d8aed17779d" +checksum = "0dbedbf4066bfab725b3f9e2a21530507419a7d2f98621d3c13213502b734ec0" dependencies = [ "cc", "tree-sitter", @@ -7980,6 +8049,16 @@ dependencies = [ "tree-sitter", ] +[[package]] +name = "tree-sitter-elixir" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a9916f3e1c80b3c8aab8582604e97e8720cb9b893489b347cf999f80f9d469e" +dependencies = [ + "cc", + "tree-sitter", +] + [[package]] name = "tree-sitter-elixir" version = "0.1.0" @@ -7991,9 +8070,9 @@ dependencies = [ [[package]] name = "tree-sitter-elm" -version = "5.6.4" +version = "5.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec83a2e1cfc69d03c8e73636e95662d6c6728539538d341b21251a77039fb94e" +checksum = "95236155fa1cd5fcf92123e7e6aa7b6e8c6756b54b5d39afd792a23bd6c9eb7b" dependencies = [ "cc", "tree-sitter", @@ -8095,9 +8174,9 @@ dependencies = [ [[package]] name = "tree-sitter-python" -version = "0.20.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda114f58048f5059dcf158aff691dffb8e113e6d2b50d94263fd68711975287" +checksum = "f47ebd9cac632764b2f4389b08517bf2ef895431dd163eb562e3d2062cc23a14" dependencies = [ "cc", "tree-sitter", @@ -8159,6 +8238,26 @@ dependencies = [ "tree-sitter", ] +[[package]] +name = "tree-sitter-toml" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca517f578a98b23d20780247cc2688407fa81effad5b627a5a364ec3339b53e8" +dependencies = [ + "cc", + "tree-sitter", +] + +[[package]] +name = "tree-sitter-typescript" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "079c695c32d39ad089101c66393aeaca30e967fba3486a91f573d2f0e12d290a" +dependencies = [ + "cc", + "tree-sitter", +] + [[package]] name = "tree-sitter-typescript" version = "0.20.2" @@ -8241,9 +8340,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "unicase" @@ -8280,9 +8379,9 @@ checksum = "7f9af028e052a610d99e066b33304625dea9613170a2563314490a4e6ec5cf7f" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -8337,9 +8436,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -8349,9 +8448,9 @@ dependencies = [ [[package]] name = "urlencoding" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" [[package]] name = "usvg" @@ -8422,20 +8521,11 @@ checksum = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22" [[package]] name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom 0.2.9", -] - -[[package]] -name = "uuid" -version = "1.3.2" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dad5567ad0cf5b760e5665964bec1b47dfd077ba8a2544b513f3556d3d239a2" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "serde", ] @@ -8447,16 +8537,38 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-bag" -version = "1.0.0-alpha.9" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" +checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" +dependencies = [ + "value-bag-serde1", + "value-bag-sval2", +] + +[[package]] +name = "value-bag-serde1" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0b9f3feef403a50d4d67e9741a6d8fc688bcbb4e4f31bd4aab72cc690284394" dependencies = [ - "ctor", "erased-serde", "serde", "serde_fmt", +] + +[[package]] +name = "value-bag-sval2" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b24f4146b6f3361e91cbf527d1fb35e9376c3c0cef72ca5ec5af6d640fad7d" +dependencies = [ "sval", - "version_check", + "sval_buffer", + "sval_dynamic", + "sval_fmt", + "sval_json", + "sval_ref", + "sval_serde", ] [[package]] @@ -8478,41 +8590,6 @@ dependencies = [ "workspace", ] -[[package]] -name = "vector_store" -version = "0.1.0" -dependencies = [ - "anyhow", - "async-trait", - "bincode", - "editor", - "futures 0.3.28", - "gpui", - "isahc", - "language", - "lazy_static", - "log", - "matrixmultiply", - "picker", - "project", - "rand 0.8.5", - "rpc", - "rusqlite", - "schemars", - "serde", - "serde_json", - "settings", - "smol", - "tempdir", - "theme", - "tiktoken-rs 0.5.0", - "tree-sitter", - "tree-sitter-rust", - "unindent", - "util", - "workspace", -] - [[package]] name = "version_check" version = "0.9.4" @@ -8587,11 +8664,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -8644,7 +8720,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e8844fede1c3787cc08853872f47e8bd91f6c939c7406bc7a5dba496b260c08" dependencies = [ "anyhow", - "bitflags", + "bitflags 1.3.2", "cap-rand", "cap-std", "io-extras", @@ -8657,9 +8733,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.85" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b6cb788c4e39112fbe1822277ef6fb3c55cd86b95cb3d3c4c1c9597e4ac74b4" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -8667,24 +8743,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.85" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e522ed4105a9d626d885b35d62501b30d9666283a5c8be12c14a8bdafe7822" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.35" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "083abe15c5d88556b77bdf7aef403625be9e327ad37c62c4e4129af740168163" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -8694,9 +8770,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.85" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "358a79a0cb89d21db8120cbfb91392335913e4890665b1a7981d9e956903b434" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -8704,28 +8780,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.85" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4783ce29f09b9d93134d41297aded3a712b7b979e9c6f28c32cb88c973a94869" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.85" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a901d592cafaa4d711bc324edfaff879ac700b19c3dfd60058d2b445be2691eb" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-encoder" -version = "0.26.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05d0b6fcd0aeb98adf16e7975331b3c17222aa815148f5b976370ce589d80ef" +checksum = "06a3d1b4a575ffb873679402b2aedb3117555eb65c27b1b86c8a91e574bc2a2a" dependencies = [ "leb128", ] @@ -8947,9 +9023,9 @@ dependencies = [ [[package]] name = "wast" -version = "57.0.0" +version = "62.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb0f5ed17ac4421193c7477da05892c2edafd67f9639e3c11a82086416662dc" +checksum = "c7f7ee878019d69436895f019b65f62c33da63595d8e857cbdc87c13ecb29a32" dependencies = [ "leb128", "memchr", @@ -8959,18 +9035,18 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.63" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab9ab0d87337c3be2bb6fc5cd331c4ba9fd6bcb4ee85048a0dd59ed9ecf92e53" +checksum = "295572bf24aa5b685a971a83ad3e8b6e684aaad8a9be24bc7bf59bed84cc1c08" dependencies = [ - "wast 57.0.0", + "wast 62.0.0", ] [[package]] name = "web-sys" -version = "0.3.62" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b5f940c7edfdc6d12126d98c9ef4d1b3d470011c47c76a6581df47ad9ba721" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -9057,9 +9133,9 @@ dependencies = [ [[package]] name = "whoami" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c70234412ca409cc04e864e89523cb0fc37f5e1344ebed5a3ebf4192b6b9f68" +checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" dependencies = [ "wasm-bindgen", "web-sys", @@ -9073,7 +9149,7 @@ checksum = "67dadac11343d2aabc8a906a0db0aaf7cb5046ec3d6fffccdaf2847dccdef8d6" dependencies = [ "anyhow", "async-trait", - "bitflags", + "bitflags 1.3.2", "thiserror", "tracing", "wasmtime", @@ -9165,31 +9241,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", + "windows-targets 0.48.1", ] [[package]] @@ -9198,7 +9250,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -9218,9 +9270,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", @@ -9317,9 +9369,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.7" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" +checksum = "25b5872fa2e10bd067ae946f927e726d7d603eaeb6e02fa6a350e0722d2b8c11" dependencies = [ "memchr", ] @@ -9339,7 +9391,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d5973cb8cd94a77d03ad7e23bbe14889cb29805da1cec0e4aff75e21aebded" dependencies = [ - "bitflags", + "bitflags 1.3.2", "io-lifetimes 0.5.3", "winapi 0.3.9", ] @@ -9401,7 +9453,7 @@ dependencies = [ "terminal", "theme", "util", - "uuid 1.3.2", + "uuid 1.4.1", ] [[package]] @@ -9414,6 +9466,15 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "xattr" version = "0.2.3" @@ -9440,7 +9501,7 @@ name = "xtask" version = "0.1.0" dependencies = [ "anyhow", - "clap 4.3.5", + "clap 4.3.19", "schemars", "serde_json", "theme", @@ -9541,6 +9602,7 @@ dependencies = [ "rsa", "rust-embed", "search", + "semantic_index", "serde", "serde_derive", "serde_json", @@ -9563,7 +9625,7 @@ dependencies = [ "tree-sitter-c", "tree-sitter-cpp", "tree-sitter-css", - "tree-sitter-elixir", + "tree-sitter-elixir 0.1.0 (git+https://github.com/elixir-lang/tree-sitter-elixir?rev=4ba9dab6e2602960d95b2b625f3386c27e08084e)", "tree-sitter-elm", "tree-sitter-embedded-template", "tree-sitter-glsl", @@ -9580,15 +9642,14 @@ dependencies = [ "tree-sitter-rust", "tree-sitter-scheme", "tree-sitter-svelte", - "tree-sitter-toml", - "tree-sitter-typescript", + "tree-sitter-toml 0.5.1", + "tree-sitter-typescript 0.20.2 (git+https://github.com/tree-sitter/tree-sitter-typescript?rev=5d20856f34315b068c41edaee2ac8a100081d259)", "tree-sitter-yaml", "unindent", "url", "urlencoding", "util", - "uuid 1.3.2", - "vector_store", + "uuid 1.4.1", "vim", "welcome", "workspace", @@ -9619,7 +9680,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 10f2160f456257f424e8afed6744db9b3ac2ecd9..fc021bee79628cdcaa150d0704846ccf8b8623cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,7 @@ members = [ "crates/theme", "crates/theme_selector", "crates/util", - "crates/vector_store", + "crates/semantic_index", "crates/vim", "crates/vcs_menu", "crates/workspace", @@ -133,7 +133,7 @@ tree-sitter-yaml = { git = "https://github.com/zed-industries/tree-sitter-yaml", tree-sitter-lua = "0.0.14" [patch.crates-io] -tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "49226023693107fba9a1191136a4f47f38cdca73" } +tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "1c65ca24bc9a734ab70115188f465e12eecf224e" } async-task = { git = "https://github.com/zed-industries/async-task", rev = "341b57d6de98cdfd7b418567b8de2022ca993a6e" } # TODO - Remove when a version is released with this PR: https://github.com/servo/core-foundation-rs/pull/457 diff --git a/assets/settings/default.json b/assets/settings/default.json index 2ae8d5c4a8d564e4b8cc4473f7a9cab844c7b5bb..397dac0961397f2dc5c34902383534e51fcb3400 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -324,8 +324,8 @@ // the terminal will default to matching the buffer's font family. // "font_family": "Zed Mono" }, - // Difference settings for vector_store - "vector_store": { + // Difference settings for semantic_index + "semantic_index": { "enabled": false, "reindexing_delay_seconds": 600 }, diff --git a/crates/language/src/language.rs b/crates/language/src/language.rs index 50a0b4b161cb2253602d0c28c769e872a331bd2e..e34358c7c5def79e8141e86e54693bcc99188da0 100644 --- a/crates/language/src/language.rs +++ b/crates/language/src/language.rs @@ -339,6 +339,8 @@ pub struct LanguageConfig { #[serde(default)] pub line_comment: Option>, #[serde(default)] + pub collapsed_placeholder: String, + #[serde(default)] pub block_comment: Option<(Arc, Arc)>, #[serde(default)] pub overrides: HashMap, @@ -408,6 +410,7 @@ impl Default for LanguageConfig { line_comment: Default::default(), block_comment: Default::default(), overrides: Default::default(), + collapsed_placeholder: Default::default(), } } } @@ -523,9 +526,10 @@ pub struct OutlineConfig { pub struct EmbeddingConfig { pub query: Query, pub item_capture_ix: u32, - pub name_capture_ix: u32, + pub name_capture_ix: Option, pub context_capture_ix: Option, - pub extra_context_capture_ix: Option, + pub collapse_capture_ix: Option, + pub keep_capture_ix: Option, } struct InjectionConfig { @@ -1247,23 +1251,26 @@ impl Language { let mut item_capture_ix = None; let mut name_capture_ix = None; let mut context_capture_ix = None; - let mut extra_context_capture_ix = None; + let mut collapse_capture_ix = None; + let mut keep_capture_ix = None; get_capture_indices( &query, &mut [ ("item", &mut item_capture_ix), ("name", &mut name_capture_ix), ("context", &mut context_capture_ix), - ("context.extra", &mut extra_context_capture_ix), + ("keep", &mut keep_capture_ix), + ("collapse", &mut collapse_capture_ix), ], ); - if let Some((item_capture_ix, name_capture_ix)) = item_capture_ix.zip(name_capture_ix) { + if let Some(item_capture_ix) = item_capture_ix { grammar.embedding_config = Some(EmbeddingConfig { query, item_capture_ix, name_capture_ix, context_capture_ix, - extra_context_capture_ix, + collapse_capture_ix, + keep_capture_ix, }); } Ok(self) @@ -1548,9 +1555,20 @@ impl Language { pub fn grammar(&self) -> Option<&Arc> { self.grammar.as_ref() } + + pub fn default_scope(self: &Arc) -> LanguageScope { + LanguageScope { + language: self.clone(), + override_id: None, + } + } } impl LanguageScope { + pub fn collapsed_placeholder(&self) -> &str { + self.language.config.collapsed_placeholder.as_ref() + } + pub fn line_comment_prefix(&self) -> Option<&Arc> { Override::as_option( self.config_override().map(|o| &o.line_comment), diff --git a/crates/search/Cargo.toml b/crates/search/Cargo.toml index b37d0a46adb7c5a7142e5b1c4e9ee5516bee3072..3a59f9a5cd0867359802d31683946f92c9841fd6 100644 --- a/crates/search/Cargo.toml +++ b/crates/search/Cargo.toml @@ -20,6 +20,7 @@ settings = { path = "../settings" } theme = { path = "../theme" } util = { path = "../util" } workspace = { path = "../workspace" } +semantic_index = { path = "../semantic_index" } anyhow.workspace = true futures.workspace = true log.workspace = true diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 9054d9e1213dcc0544af0faeb35eb8bd74a3f117..52ee12c26de17274d5cd8c5d39a69843cbcb7869 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -18,7 +18,9 @@ use gpui::{ Task, View, ViewContext, ViewHandle, WeakModelHandle, WeakViewHandle, }; use menu::Confirm; +use postage::stream::Stream; use project::{search::SearchQuery, Entry, Project}; +use semantic_index::SemanticIndex; use smallvec::SmallVec; use std::{ any::{Any, TypeId}, @@ -36,7 +38,10 @@ use workspace::{ ItemNavHistory, Pane, ToolbarItemLocation, ToolbarItemView, Workspace, WorkspaceId, }; -actions!(project_search, [SearchInNew, ToggleFocus, NextField]); +actions!( + project_search, + [SearchInNew, ToggleFocus, NextField, ToggleSemanticSearch] +); #[derive(Default)] struct ActiveSearches(HashMap, WeakViewHandle>); @@ -89,6 +94,7 @@ pub struct ProjectSearchView { model: ModelHandle, query_editor: ViewHandle, results_editor: ViewHandle, + semantic: Option, search_options: SearchOptions, panels_with_errors: HashSet, active_match_index: Option, @@ -98,6 +104,12 @@ pub struct ProjectSearchView { excluded_files_editor: ViewHandle, } +struct SemanticSearchState { + file_count: usize, + outstanding_file_count: usize, + _progress_task: Task<()>, +} + pub struct ProjectSearchBar { active_project_search: Option>, subscription: Option, @@ -172,6 +184,63 @@ impl ProjectSearch { })); cx.notify(); } + + fn semantic_search( + &mut self, + query: String, + include_files: Vec, + exclude_files: Vec, + cx: &mut ModelContext, + ) { + let search = SemanticIndex::global(cx).map(|index| { + index.update(cx, |semantic_index, cx| { + semantic_index.search_project( + self.project.clone(), + query.clone(), + 10, + include_files, + exclude_files, + cx, + ) + }) + }); + self.search_id += 1; + self.match_ranges.clear(); + self.pending_search = Some(cx.spawn(|this, mut cx| async move { + let results = search?.await.log_err()?; + + let (_task, mut match_ranges) = this.update(&mut cx, |this, cx| { + this.excerpts.update(cx, |excerpts, cx| { + excerpts.clear(cx); + + let matches = results + .into_iter() + .map(|result| (result.buffer, vec![result.range.start..result.range.start])) + .collect(); + + excerpts.stream_excerpts_with_context_lines(matches, 3, cx) + }) + }); + + while let Some(match_range) = match_ranges.next().await { + this.update(&mut cx, |this, cx| { + this.match_ranges.push(match_range); + while let Ok(Some(match_range)) = match_ranges.try_next() { + this.match_ranges.push(match_range); + } + cx.notify(); + }); + } + + this.update(&mut cx, |this, cx| { + this.pending_search.take(); + cx.notify(); + }); + + None + })); + cx.notify(); + } } pub enum ViewEvent { @@ -195,13 +264,24 @@ impl View for ProjectSearchView { enum Status {} let theme = theme::current(cx).clone(); - let text = if self.query_editor.read(cx).text(cx).is_empty() { - "" - } else if model.pending_search.is_some() { - "Searching..." + let text = if model.pending_search.is_some() { + Cow::Borrowed("Searching...") + } else if let Some(semantic) = &self.semantic { + if semantic.outstanding_file_count > 0 { + Cow::Owned(format!( + "Indexing. {} of {}...", + semantic.file_count - semantic.outstanding_file_count, + semantic.file_count + )) + } else { + Cow::Borrowed("Indexing complete") + } + } else if self.query_editor.read(cx).text(cx).is_empty() { + Cow::Borrowed("") } else { - "No results" + Cow::Borrowed("No results") }; + MouseEventHandler::::new(0, cx, |_, _| { Label::new(text, theme.search.results_status.clone()) .aligned() @@ -490,6 +570,7 @@ impl ProjectSearchView { model, query_editor, results_editor, + semantic: None, search_options: options, panels_with_errors: HashSet::new(), active_match_index: None, @@ -577,11 +658,59 @@ impl ProjectSearchView { } fn search(&mut self, cx: &mut ViewContext) { + if let Some(semantic) = &mut self.semantic { + if semantic.outstanding_file_count > 0 { + return; + } + + let query = self.query_editor.read(cx).text(cx); + if let Some((included_files, exclude_files)) = + self.get_included_and_excluded_globsets(cx) + { + self.model.update(cx, |model, cx| { + model.semantic_search(query, included_files, exclude_files, cx) + }); + } + return; + } + if let Some(query) = self.build_search_query(cx) { self.model.update(cx, |model, cx| model.search(query, cx)); } } + fn get_included_and_excluded_globsets( + &mut self, + cx: &mut ViewContext, + ) -> Option<(Vec, Vec)> { + let included_files = + match Self::load_glob_set(&self.included_files_editor.read(cx).text(cx)) { + Ok(included_files) => { + self.panels_with_errors.remove(&InputPanel::Include); + included_files + } + Err(_e) => { + self.panels_with_errors.insert(InputPanel::Include); + cx.notify(); + return None; + } + }; + let excluded_files = + match Self::load_glob_set(&self.excluded_files_editor.read(cx).text(cx)) { + Ok(excluded_files) => { + self.panels_with_errors.remove(&InputPanel::Exclude); + excluded_files + } + Err(_e) => { + self.panels_with_errors.insert(InputPanel::Exclude); + cx.notify(); + return None; + } + }; + + Some((included_files, excluded_files)) + } + fn build_search_query(&mut self, cx: &mut ViewContext) -> Option { let text = self.query_editor.read(cx).text(cx); let included_files = @@ -873,6 +1002,7 @@ impl ProjectSearchBar { if let Some(search_view) = self.active_project_search.as_ref() { search_view.update(cx, |search_view, cx| { search_view.search_options.toggle(option); + search_view.semantic = None; search_view.search(cx); }); cx.notify(); @@ -882,6 +1012,61 @@ impl ProjectSearchBar { } } + fn toggle_semantic_search(&mut self, cx: &mut ViewContext) -> bool { + if let Some(search_view) = self.active_project_search.as_ref() { + search_view.update(cx, |search_view, cx| { + if search_view.semantic.is_some() { + search_view.semantic = None; + } else if let Some(semantic_index) = SemanticIndex::global(cx) { + // TODO: confirm that it's ok to send this project + search_view.search_options = SearchOptions::none(); + + let project = search_view.model.read(cx).project.clone(); + let index_task = semantic_index.update(cx, |semantic_index, cx| { + semantic_index.index_project(project, cx) + }); + + cx.spawn(|search_view, mut cx| async move { + let (files_to_index, mut files_remaining_rx) = index_task.await?; + + search_view.update(&mut cx, |search_view, cx| { + cx.notify(); + search_view.semantic = Some(SemanticSearchState { + file_count: files_to_index, + outstanding_file_count: files_to_index, + _progress_task: cx.spawn(|search_view, mut cx| async move { + while let Some(count) = files_remaining_rx.recv().await { + search_view + .update(&mut cx, |search_view, cx| { + if let Some(semantic_search_state) = + &mut search_view.semantic + { + semantic_search_state.outstanding_file_count = + count; + cx.notify(); + if count == 0 { + return; + } + } + }) + .ok(); + } + }), + }); + })?; + anyhow::Ok(()) + }) + .detach_and_log_err(cx); + } + cx.notify(); + }); + cx.notify(); + true + } else { + false + } + } + fn render_nav_button( &self, icon: &'static str, @@ -959,6 +1144,42 @@ impl ProjectSearchBar { .into_any() } + fn render_semantic_search_button(&self, cx: &mut ViewContext) -> AnyElement { + let tooltip_style = theme::current(cx).tooltip.clone(); + let is_active = if let Some(search) = self.active_project_search.as_ref() { + let search = search.read(cx); + search.semantic.is_some() + } else { + false + }; + + let region_id = 3; + + MouseEventHandler::::new(region_id, cx, |state, cx| { + let theme = theme::current(cx); + let style = theme + .search + .option_button + .in_state(is_active) + .style_for(state); + Label::new("Semantic", style.text.clone()) + .contained() + .with_style(style.container) + }) + .on_click(MouseButton::Left, move |_, this, cx| { + this.toggle_semantic_search(cx); + }) + .with_cursor_style(CursorStyle::PointingHand) + .with_tooltip::( + region_id, + format!("Toggle Semantic Search"), + Some(Box::new(ToggleSemanticSearch)), + tooltip_style, + cx, + ) + .into_any() + } + fn is_option_enabled(&self, option: SearchOptions, cx: &AppContext) -> bool { if let Some(search) = self.active_project_search.as_ref() { search.read(cx).search_options.contains(option) @@ -1048,8 +1269,14 @@ impl View for ProjectSearchBar { .with_child(self.render_nav_button(">", Direction::Next, cx)) .aligned(), ) - .with_child( - Flex::row() + .with_child({ + let row = if SemanticIndex::enabled(cx) { + Flex::row().with_child(self.render_semantic_search_button(cx)) + } else { + Flex::row() + }; + + let row = row .with_child(self.render_option_button( "Case", SearchOptions::CASE_SENSITIVE, @@ -1067,8 +1294,10 @@ impl View for ProjectSearchBar { )) .contained() .with_style(theme.search.option_button_group) - .aligned(), - ) + .aligned(); + + row + }) .contained() .with_margin_bottom(row_spacing), ) diff --git a/crates/search/src/search.rs b/crates/search/src/search.rs index 1303f81e2ca20a0416bbb0cdf680471779d2aee1..58cda0c7dc5f819ec1b34cd97ff577331cc030b0 100644 --- a/crates/search/src/search.rs +++ b/crates/search/src/search.rs @@ -53,6 +53,10 @@ impl SearchOptions { } } + pub fn none() -> SearchOptions { + SearchOptions::NONE + } + pub fn from_query(query: &SearchQuery) -> SearchOptions { let mut options = SearchOptions::NONE; options.set(SearchOptions::WHOLE_WORD, query.whole_word()); diff --git a/crates/vector_store/Cargo.toml b/crates/semantic_index/Cargo.toml similarity index 79% rename from crates/vector_store/Cargo.toml rename to crates/semantic_index/Cargo.toml index 40bff8b95c167e43c9f20d31e47871d52d5ff8b1..a1f126bfb841ecb8334aeca391ac4959ef9f57b0 100644 --- a/crates/vector_store/Cargo.toml +++ b/crates/semantic_index/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "vector_store" +name = "semantic_index" version = "0.1.0" edition = "2021" publish = false [lib] -path = "src/vector_store.rs" +path = "src/semantic_index.rs" doctest = false [dependencies] @@ -20,6 +20,7 @@ editor = { path = "../editor" } rpc = { path = "../rpc" } settings = { path = "../settings" } anyhow.workspace = true +postage.workspace = true futures.workspace = true smol.workspace = true rusqlite = { version = "0.27.0", features = ["blob", "array", "modern_sqlite"] } @@ -33,8 +34,10 @@ async-trait.workspace = true bincode = "1.3.3" matrixmultiply = "0.3.7" tiktoken-rs = "0.5.0" +parking_lot.workspace = true rand.workspace = true schemars.workspace = true +globset.workspace = true [dev-dependencies] gpui = { path = "../gpui", features = ["test-support"] } @@ -43,7 +46,17 @@ project = { path = "../project", features = ["test-support"] } rpc = { path = "../rpc", features = ["test-support"] } workspace = { path = "../workspace", features = ["test-support"] } settings = { path = "../settings", features = ["test-support"]} -tree-sitter-rust = "*" + +pretty_assertions.workspace = true rand.workspace = true unindent.workspace = true tempdir.workspace = true +ctor.workspace = true +env_logger.workspace = true + +tree-sitter-typescript = "*" +tree-sitter-json = "*" +tree-sitter-rust = "*" +tree-sitter-toml = "*" +tree-sitter-cpp = "*" +tree-sitter-elixir = "*" diff --git a/crates/vector_store/README.md b/crates/semantic_index/README.md similarity index 100% rename from crates/vector_store/README.md rename to crates/semantic_index/README.md diff --git a/crates/vector_store/src/db.rs b/crates/semantic_index/src/db.rs similarity index 55% rename from crates/vector_store/src/db.rs rename to crates/semantic_index/src/db.rs index a91a1872b59774a1863ae2a9ff867cf1b7ad39b3..4bc97da0f08e3d56dd249da72cd8deaff56f7e0f 100644 --- a/crates/vector_store/src/db.rs +++ b/crates/semantic_index/src/db.rs @@ -1,21 +1,22 @@ +use crate::{parsing::Document, SEMANTIC_INDEX_VERSION}; +use anyhow::{anyhow, Context, Result}; +use globset::GlobMatcher; +use project::Fs; +use rpc::proto::Timestamp; +use rusqlite::{ + params, + types::{FromSql, FromSqlResult, ValueRef}, +}; use std::{ cmp::Ordering, collections::HashMap, + ops::Range, path::{Path, PathBuf}, rc::Rc, + sync::Arc, time::SystemTime, }; -use anyhow::{anyhow, Result}; - -use crate::parsing::ParsedFile; -use crate::VECTOR_STORE_VERSION; -use rpc::proto::Timestamp; -use rusqlite::{ - params, - types::{FromSql, FromSqlResult, ValueRef}, -}; - #[derive(Debug)] pub struct FileRecord { pub id: usize, @@ -42,48 +43,94 @@ pub struct VectorDatabase { } impl VectorDatabase { - pub fn new(path: String) -> Result { + pub async fn new(fs: Arc, path: Arc) -> Result { + if let Some(db_directory) = path.parent() { + fs.create_dir(db_directory).await?; + } + let this = Self { - db: rusqlite::Connection::open(path)?, + db: rusqlite::Connection::open(path.as_path())?, }; this.initialize_database()?; Ok(this) } + fn get_existing_version(&self) -> Result { + let mut version_query = self + .db + .prepare("SELECT version from semantic_index_config")?; + version_query + .query_row([], |row| Ok(row.get::<_, i64>(0)?)) + .map_err(|err| anyhow!("version query failed: {err}")) + } + fn initialize_database(&self) -> Result<()> { rusqlite::vtab::array::load_module(&self.db)?; - // This will create the database if it doesnt exist + // Delete existing tables, if SEMANTIC_INDEX_VERSION is bumped + if self + .get_existing_version() + .map_or(false, |version| version == SEMANTIC_INDEX_VERSION as i64) + { + log::trace!("vector database schema up to date"); + return Ok(()); + } + + log::trace!("vector database schema out of date. updating..."); + self.db + .execute("DROP TABLE IF EXISTS documents", []) + .context("failed to drop 'documents' table")?; + self.db + .execute("DROP TABLE IF EXISTS files", []) + .context("failed to drop 'files' table")?; + self.db + .execute("DROP TABLE IF EXISTS worktrees", []) + .context("failed to drop 'worktrees' table")?; + self.db + .execute("DROP TABLE IF EXISTS semantic_index_config", []) + .context("failed to drop 'semantic_index_config' table")?; // Initialize Vector Databasing Tables self.db.execute( - "CREATE TABLE IF NOT EXISTS worktrees ( + "CREATE TABLE semantic_index_config ( + version INTEGER NOT NULL + )", + [], + )?; + + self.db.execute( + "INSERT INTO semantic_index_config (version) VALUES (?1)", + params![SEMANTIC_INDEX_VERSION], + )?; + + self.db.execute( + "CREATE TABLE worktrees ( id INTEGER PRIMARY KEY AUTOINCREMENT, absolute_path VARCHAR NOT NULL ); - CREATE UNIQUE INDEX IF NOT EXISTS worktrees_absolute_path ON worktrees (absolute_path); + CREATE UNIQUE INDEX worktrees_absolute_path ON worktrees (absolute_path); ", [], )?; self.db.execute( - "CREATE TABLE IF NOT EXISTS files ( + "CREATE TABLE files ( id INTEGER PRIMARY KEY AUTOINCREMENT, worktree_id INTEGER NOT NULL, relative_path VARCHAR NOT NULL, mtime_seconds INTEGER NOT NULL, mtime_nanos INTEGER NOT NULL, - vector_store_version INTEGER NOT NULL, FOREIGN KEY(worktree_id) REFERENCES worktrees(id) ON DELETE CASCADE )", [], )?; self.db.execute( - "CREATE TABLE IF NOT EXISTS documents ( + "CREATE TABLE documents ( id INTEGER PRIMARY KEY AUTOINCREMENT, file_id INTEGER NOT NULL, - offset INTEGER NOT NULL, + start_byte INTEGER NOT NULL, + end_byte INTEGER NOT NULL, name VARCHAR NOT NULL, embedding BLOB NOT NULL, FOREIGN KEY(file_id) REFERENCES files(id) ON DELETE CASCADE @@ -91,6 +138,7 @@ impl VectorDatabase { [], )?; + log::trace!("vector database initialized with updated schema."); Ok(()) } @@ -102,43 +150,44 @@ impl VectorDatabase { Ok(()) } - pub fn insert_file(&self, worktree_id: i64, indexed_file: ParsedFile) -> Result<()> { + pub fn insert_file( + &self, + worktree_id: i64, + path: PathBuf, + mtime: SystemTime, + documents: Vec, + ) -> Result<()> { // Write to files table, and return generated id. self.db.execute( " DELETE FROM files WHERE worktree_id = ?1 AND relative_path = ?2; ", - params![worktree_id, indexed_file.path.to_str()], + params![worktree_id, path.to_str()], )?; - let mtime = Timestamp::from(indexed_file.mtime); + let mtime = Timestamp::from(mtime); self.db.execute( " INSERT INTO files - (worktree_id, relative_path, mtime_seconds, mtime_nanos, vector_store_version) + (worktree_id, relative_path, mtime_seconds, mtime_nanos) VALUES - (?1, ?2, $3, $4, $5); + (?1, ?2, $3, $4); ", - params![ - worktree_id, - indexed_file.path.to_str(), - mtime.seconds, - mtime.nanos, - VECTOR_STORE_VERSION - ], + params![worktree_id, path.to_str(), mtime.seconds, mtime.nanos], )?; let file_id = self.db.last_insert_rowid(); // Currently inserting at approximately 3400 documents a second // I imagine we can speed this up with a bulk insert of some kind. - for document in indexed_file.documents { + for document in documents { let embedding_blob = bincode::serialize(&document.embedding)?; self.db.execute( - "INSERT INTO documents (file_id, offset, name, embedding) VALUES (?1, ?2, ?3, ?4)", + "INSERT INTO documents (file_id, start_byte, end_byte, name, embedding) VALUES (?1, ?2, ?3, ?4, $5)", params![ file_id, - document.offset.to_string(), + document.range.start.to_string(), + document.range.end.to_string(), document.name, embedding_blob ], @@ -148,6 +197,23 @@ impl VectorDatabase { Ok(()) } + pub fn worktree_previously_indexed(&self, worktree_root_path: &Path) -> Result { + let mut worktree_query = self + .db + .prepare("SELECT id FROM worktrees WHERE absolute_path = ?1")?; + let worktree_id = worktree_query + .query_row(params![worktree_root_path.to_string_lossy()], |row| { + Ok(row.get::<_, i64>(0)?) + }) + .map_err(|err| anyhow!(err)); + + if worktree_id.is_ok() { + return Ok(true); + } else { + return Ok(false); + } + } + pub fn find_or_create_worktree(&self, worktree_root_path: &Path) -> Result { // Check that the absolute path doesnt exist let mut worktree_query = self @@ -204,19 +270,26 @@ impl VectorDatabase { worktree_ids: &[i64], query_embedding: &Vec, limit: usize, - ) -> Result> { + include_globs: Vec, + exclude_globs: Vec, + ) -> Result)>> { let mut results = Vec::<(i64, f32)>::with_capacity(limit + 1); - self.for_each_document(&worktree_ids, |id, embedding| { - let similarity = dot(&embedding, &query_embedding); - let ix = match results - .binary_search_by(|(_, s)| similarity.partial_cmp(&s).unwrap_or(Ordering::Equal)) - { - Ok(ix) => ix, - Err(ix) => ix, - }; - results.insert(ix, (id, similarity)); - results.truncate(limit); - })?; + self.for_each_document( + &worktree_ids, + include_globs, + exclude_globs, + |id, embedding| { + let similarity = dot(&embedding, &query_embedding); + let ix = match results.binary_search_by(|(_, s)| { + similarity.partial_cmp(&s).unwrap_or(Ordering::Equal) + }) { + Ok(ix) => ix, + Err(ix) => ix, + }; + results.insert(ix, (id, similarity)); + results.truncate(limit); + }, + )?; let ids = results.into_iter().map(|(id, _)| id).collect::>(); self.get_documents_by_ids(&ids) @@ -225,22 +298,51 @@ impl VectorDatabase { fn for_each_document( &self, worktree_ids: &[i64], + include_globs: Vec, + exclude_globs: Vec, mut f: impl FnMut(i64, Vec), ) -> Result<()> { + let mut file_query = self.db.prepare( + " + SELECT + id, relative_path + FROM + files + WHERE + worktree_id IN rarray(?) + ", + )?; + + let mut file_ids = Vec::::new(); + let mut rows = file_query.query([ids_to_sql(worktree_ids)])?; + while let Some(row) = rows.next()? { + let file_id = row.get(0)?; + let relative_path = row.get_ref(1)?.as_str()?; + let included = include_globs.is_empty() + || include_globs + .iter() + .any(|glob| glob.is_match(relative_path)); + let excluded = exclude_globs + .iter() + .any(|glob| glob.is_match(relative_path)); + if included && !excluded { + file_ids.push(file_id); + } + } + let mut query_statement = self.db.prepare( " SELECT - documents.id, documents.embedding + id, embedding FROM - documents, files + documents WHERE - documents.file_id = files.id AND - files.worktree_id IN rarray(?) + file_id IN rarray(?) ", )?; query_statement - .query_map(params![ids_to_sql(worktree_ids)], |row| { + .query_map(params![ids_to_sql(&file_ids)], |row| { Ok((row.get(0)?, row.get::<_, Embedding>(1)?)) })? .filter_map(|row| row.ok()) @@ -248,11 +350,15 @@ impl VectorDatabase { Ok(()) } - fn get_documents_by_ids(&self, ids: &[i64]) -> Result> { + fn get_documents_by_ids(&self, ids: &[i64]) -> Result)>> { let mut statement = self.db.prepare( " SELECT - documents.id, files.worktree_id, files.relative_path, documents.offset, documents.name + documents.id, + files.worktree_id, + files.relative_path, + documents.start_byte, + documents.end_byte FROM documents, files WHERE @@ -266,15 +372,14 @@ impl VectorDatabase { row.get::<_, i64>(0)?, row.get::<_, i64>(1)?, row.get::<_, String>(2)?.into(), - row.get(3)?, - row.get(4)?, + row.get(3)?..row.get(4)?, )) })?; - let mut values_by_id = HashMap::::default(); + let mut values_by_id = HashMap::)>::default(); for row in result_iter { - let (id, worktree_id, path, offset, name) = row?; - values_by_id.insert(id, (worktree_id, path, offset, name)); + let (id, worktree_id, path, range) = row?; + values_by_id.insert(id, (worktree_id, path, range)); } let mut results = Vec::with_capacity(ids.len()); diff --git a/crates/vector_store/src/embedding.rs b/crates/semantic_index/src/embedding.rs similarity index 80% rename from crates/vector_store/src/embedding.rs rename to crates/semantic_index/src/embedding.rs index 2ddade6bb290a7cf93f14ba2bdf4eceb89554c89..77457ec7f6e34961ab2a784ef6f0d8068c4c1dbb 100644 --- a/crates/vector_store/src/embedding.rs +++ b/crates/semantic_index/src/embedding.rs @@ -67,17 +67,16 @@ impl EmbeddingProvider for DummyEmbeddings { } } -const INPUT_LIMIT: usize = 8190; +const OPENAI_INPUT_LIMIT: usize = 8190; impl OpenAIEmbeddings { fn truncate(span: String) -> String { let mut tokens = OPENAI_BPE_TOKENIZER.encode_with_special_tokens(span.as_ref()); - if tokens.len() > INPUT_LIMIT { - tokens.truncate(INPUT_LIMIT); + if tokens.len() > OPENAI_INPUT_LIMIT { + tokens.truncate(OPENAI_INPUT_LIMIT); let result = OPENAI_BPE_TOKENIZER.decode(tokens.clone()); if result.is_ok() { let transformed = result.unwrap(); - // assert_ne!(transformed, span); return transformed; } } @@ -88,6 +87,7 @@ impl OpenAIEmbeddings { async fn send_request(&self, api_key: &str, spans: Vec<&str>) -> Result> { let request = Request::post("https://api.openai.com/v1/embeddings") .redirect_policy(isahc::config::RedirectPolicy::Follow) + .timeout(Duration::from_secs(4)) .header("Content-Type", "application/json") .header("Authorization", format!("Bearer {}", api_key)) .body( @@ -106,7 +106,7 @@ impl OpenAIEmbeddings { #[async_trait] impl EmbeddingProvider for OpenAIEmbeddings { async fn embed_batch(&self, spans: Vec<&str>) -> Result>> { - const BACKOFF_SECONDS: [usize; 3] = [65, 180, 360]; + const BACKOFF_SECONDS: [usize; 3] = [45, 75, 125]; const MAX_RETRIES: usize = 3; let api_key = OPENAI_API_KEY @@ -114,6 +114,7 @@ impl EmbeddingProvider for OpenAIEmbeddings { .ok_or_else(|| anyhow!("no api key"))?; let mut request_number = 0; + let mut truncated = false; let mut response: Response; let mut spans: Vec = spans.iter().map(|x| x.to_string()).collect(); while request_number < MAX_RETRIES { @@ -132,14 +133,25 @@ impl EmbeddingProvider for OpenAIEmbeddings { match response.status() { StatusCode::TOO_MANY_REQUESTS => { let delay = Duration::from_secs(BACKOFF_SECONDS[request_number - 1] as u64); + log::trace!( + "open ai rate limiting, delaying request by {:?} seconds", + delay.as_secs() + ); self.executor.timer(delay).await; } StatusCode::BAD_REQUEST => { - log::info!("BAD REQUEST: {:?}", &response.status()); - // Don't worry about delaying bad request, as we can assume - // we haven't been rate limited yet. - for span in spans.iter_mut() { - *span = Self::truncate(span.to_string()); + // Only truncate if it hasnt been truncated before + if !truncated { + for span in spans.iter_mut() { + *span = Self::truncate(span.clone()); + } + truncated = true; + } else { + // If failing once already truncated, log the error and break the loop + let mut body = String::new(); + response.body_mut().read_to_string(&mut body).await?; + log::trace!("open ai bad request: {:?} {:?}", &response.status(), body); + break; } } StatusCode::OK => { @@ -147,7 +159,7 @@ impl EmbeddingProvider for OpenAIEmbeddings { response.body_mut().read_to_string(&mut body).await?; let response: OpenAIEmbeddingResponse = serde_json::from_str(&body)?; - log::info!( + log::trace!( "openai embedding completed. tokens: {:?}", response.usage.total_tokens ); diff --git a/crates/semantic_index/src/parsing.rs b/crates/semantic_index/src/parsing.rs new file mode 100644 index 0000000000000000000000000000000000000000..c952ef3a4edf939ddc8ad17c9bab6e17ec5e0cce --- /dev/null +++ b/crates/semantic_index/src/parsing.rs @@ -0,0 +1,299 @@ +use anyhow::{anyhow, Ok, Result}; +use language::{Grammar, Language}; +use std::{ + cmp::{self, Reverse}, + collections::HashSet, + ops::Range, + path::Path, + sync::Arc, +}; +use tree_sitter::{Parser, QueryCursor}; + +#[derive(Debug, PartialEq, Clone)] +pub struct Document { + pub name: String, + pub range: Range, + pub content: String, + pub embedding: Vec, +} + +const CODE_CONTEXT_TEMPLATE: &str = + "The below code snippet is from file ''\n\n```\n\n```"; +const ENTIRE_FILE_TEMPLATE: &str = + "The below snippet is from file ''\n\n```\n\n```"; +pub const PARSEABLE_ENTIRE_FILE_TYPES: &[&str] = &["TOML", "YAML", "CSS"]; + +pub struct CodeContextRetriever { + pub parser: Parser, + pub cursor: QueryCursor, +} + +// Every match has an item, this represents the fundamental treesitter symbol and anchors the search +// Every match has one or more 'name' captures. These indicate the display range of the item for deduplication. +// If there are preceeding comments, we track this with a context capture +// If there is a piece that should be collapsed in hierarchical queries, we capture it with a collapse capture +// If there is a piece that should be kept inside a collapsed node, we capture it with a keep capture +#[derive(Debug, Clone)] +pub struct CodeContextMatch { + pub start_col: usize, + pub item_range: Option>, + pub name_range: Option>, + pub context_ranges: Vec>, + pub collapse_ranges: Vec>, +} + +impl CodeContextRetriever { + pub fn new() -> Self { + Self { + parser: Parser::new(), + cursor: QueryCursor::new(), + } + } + + fn parse_entire_file( + &self, + relative_path: &Path, + language_name: Arc, + content: &str, + ) -> Result> { + let document_span = ENTIRE_FILE_TEMPLATE + .replace("", relative_path.to_string_lossy().as_ref()) + .replace("", language_name.as_ref()) + .replace("item", &content); + + Ok(vec![Document { + range: 0..content.len(), + content: document_span, + embedding: Vec::new(), + name: language_name.to_string(), + }]) + } + + fn get_matches_in_file( + &mut self, + content: &str, + grammar: &Arc, + ) -> Result> { + let embedding_config = grammar + .embedding_config + .as_ref() + .ok_or_else(|| anyhow!("no embedding queries"))?; + self.parser.set_language(grammar.ts_language).unwrap(); + + let tree = self + .parser + .parse(&content, None) + .ok_or_else(|| anyhow!("parsing failed"))?; + + let mut captures: Vec = Vec::new(); + let mut collapse_ranges: Vec> = Vec::new(); + let mut keep_ranges: Vec> = Vec::new(); + for mat in self.cursor.matches( + &embedding_config.query, + tree.root_node(), + content.as_bytes(), + ) { + let mut start_col = 0; + let mut item_range: Option> = None; + let mut name_range: Option> = None; + let mut context_ranges: Vec> = Vec::new(); + collapse_ranges.clear(); + keep_ranges.clear(); + for capture in mat.captures { + if capture.index == embedding_config.item_capture_ix { + item_range = Some(capture.node.byte_range()); + start_col = capture.node.start_position().column; + } else if Some(capture.index) == embedding_config.name_capture_ix { + name_range = Some(capture.node.byte_range()); + } else if Some(capture.index) == embedding_config.context_capture_ix { + context_ranges.push(capture.node.byte_range()); + } else if Some(capture.index) == embedding_config.collapse_capture_ix { + collapse_ranges.push(capture.node.byte_range()); + } else if Some(capture.index) == embedding_config.keep_capture_ix { + keep_ranges.push(capture.node.byte_range()); + } + } + + captures.push(CodeContextMatch { + start_col, + item_range, + name_range, + context_ranges, + collapse_ranges: subtract_ranges(&collapse_ranges, &keep_ranges), + }); + } + Ok(captures) + } + + pub fn parse_file_with_template( + &mut self, + relative_path: &Path, + content: &str, + language: Arc, + ) -> Result> { + let language_name = language.name(); + + if PARSEABLE_ENTIRE_FILE_TYPES.contains(&language_name.as_ref()) { + return self.parse_entire_file(relative_path, language_name, &content); + } + + let mut documents = self.parse_file(content, language)?; + for document in &mut documents { + document.content = CODE_CONTEXT_TEMPLATE + .replace("", relative_path.to_string_lossy().as_ref()) + .replace("", language_name.as_ref()) + .replace("item", &document.content); + } + Ok(documents) + } + + pub fn parse_file(&mut self, content: &str, language: Arc) -> Result> { + let grammar = language + .grammar() + .ok_or_else(|| anyhow!("no grammar for language"))?; + + // Iterate through query matches + let matches = self.get_matches_in_file(content, grammar)?; + + let language_scope = language.default_scope(); + let placeholder = language_scope.collapsed_placeholder(); + + let mut documents = Vec::new(); + let mut collapsed_ranges_within = Vec::new(); + let mut parsed_name_ranges = HashSet::new(); + for (i, context_match) in matches.iter().enumerate() { + // Items which are collapsible but not embeddable have no item range + let item_range = if let Some(item_range) = context_match.item_range.clone() { + item_range + } else { + continue; + }; + + // Checks for deduplication + let name; + if let Some(name_range) = context_match.name_range.clone() { + name = content + .get(name_range.clone()) + .map_or(String::new(), |s| s.to_string()); + if parsed_name_ranges.contains(&name_range) { + continue; + } + parsed_name_ranges.insert(name_range); + } else { + name = String::new(); + } + + collapsed_ranges_within.clear(); + 'outer: for remaining_match in &matches[(i + 1)..] { + for collapsed_range in &remaining_match.collapse_ranges { + if item_range.start <= collapsed_range.start + && item_range.end >= collapsed_range.end + { + collapsed_ranges_within.push(collapsed_range.clone()); + } else { + break 'outer; + } + } + } + + collapsed_ranges_within.sort_by_key(|r| (r.start, Reverse(r.end))); + + let mut document_content = String::new(); + for context_range in &context_match.context_ranges { + document_content.push_str(&content[context_range.clone()]); + document_content.push_str("\n"); + } + + let mut offset = item_range.start; + for collapsed_range in &collapsed_ranges_within { + if collapsed_range.start > offset { + add_content_from_range( + &mut document_content, + content, + offset..collapsed_range.start, + context_match.start_col, + ); + offset = collapsed_range.start; + } + + if collapsed_range.end > offset { + document_content.push_str(placeholder); + offset = collapsed_range.end; + } + } + + if offset < item_range.end { + add_content_from_range( + &mut document_content, + content, + offset..item_range.end, + context_match.start_col, + ); + } + + documents.push(Document { + name, + content: document_content, + range: item_range.clone(), + embedding: vec![], + }) + } + + return Ok(documents); + } +} + +pub(crate) fn subtract_ranges( + ranges: &[Range], + ranges_to_subtract: &[Range], +) -> Vec> { + let mut result = Vec::new(); + + let mut ranges_to_subtract = ranges_to_subtract.iter().peekable(); + + for range in ranges { + let mut offset = range.start; + + while offset < range.end { + if let Some(range_to_subtract) = ranges_to_subtract.peek() { + if offset < range_to_subtract.start { + let next_offset = cmp::min(range_to_subtract.start, range.end); + result.push(offset..next_offset); + offset = next_offset; + } else { + let next_offset = cmp::min(range_to_subtract.end, range.end); + offset = next_offset; + } + + if offset >= range_to_subtract.end { + ranges_to_subtract.next(); + } + } else { + result.push(offset..range.end); + offset = range.end; + } + } + } + + result +} + +fn add_content_from_range( + output: &mut String, + content: &str, + range: Range, + start_col: usize, +) { + for mut line in content.get(range.clone()).unwrap_or("").lines() { + for _ in 0..start_col { + if line.starts_with(' ') { + line = &line[1..]; + } else { + break; + } + } + output.push_str(line); + output.push('\n'); + } + output.pop(); +} diff --git a/crates/semantic_index/src/semantic_index.rs b/crates/semantic_index/src/semantic_index.rs new file mode 100644 index 0000000000000000000000000000000000000000..e4a307573aabc00336863b23a799138c52adc895 --- /dev/null +++ b/crates/semantic_index/src/semantic_index.rs @@ -0,0 +1,777 @@ +mod db; +mod embedding; +mod parsing; +pub mod semantic_index_settings; + +#[cfg(test)] +mod semantic_index_tests; + +use crate::semantic_index_settings::SemanticIndexSettings; +use anyhow::{anyhow, Result}; +use db::VectorDatabase; +use embedding::{EmbeddingProvider, OpenAIEmbeddings}; +use futures::{channel::oneshot, Future}; +use globset::GlobMatcher; +use gpui::{AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, Task, WeakModelHandle}; +use language::{Anchor, Buffer, Language, LanguageRegistry}; +use parking_lot::Mutex; +use parsing::{CodeContextRetriever, Document, PARSEABLE_ENTIRE_FILE_TYPES}; +use postage::watch; +use project::{Fs, Project, WorktreeId}; +use smol::channel; +use std::{ + collections::HashMap, + mem, + ops::Range, + path::{Path, PathBuf}, + sync::{Arc, Weak}, + time::{Instant, SystemTime}, +}; +use util::{ + channel::{ReleaseChannel, RELEASE_CHANNEL, RELEASE_CHANNEL_NAME}, + http::HttpClient, + paths::EMBEDDINGS_DIR, + ResultExt, +}; + +const SEMANTIC_INDEX_VERSION: usize = 6; +const EMBEDDINGS_BATCH_SIZE: usize = 80; + +pub fn init( + fs: Arc, + http_client: Arc, + language_registry: Arc, + cx: &mut AppContext, +) { + settings::register::(cx); + + let db_file_path = EMBEDDINGS_DIR + .join(Path::new(RELEASE_CHANNEL_NAME.as_str())) + .join("embeddings_db"); + + if *RELEASE_CHANNEL == ReleaseChannel::Stable + || !settings::get::(cx).enabled + { + return; + } + + cx.spawn(move |mut cx| async move { + let semantic_index = SemanticIndex::new( + fs, + db_file_path, + Arc::new(OpenAIEmbeddings { + client: http_client, + executor: cx.background(), + }), + language_registry, + cx.clone(), + ) + .await?; + + cx.update(|cx| { + cx.set_global(semantic_index.clone()); + }); + + anyhow::Ok(()) + }) + .detach(); +} + +pub struct SemanticIndex { + fs: Arc, + database_url: Arc, + embedding_provider: Arc, + language_registry: Arc, + db_update_tx: channel::Sender, + parsing_files_tx: channel::Sender, + _db_update_task: Task<()>, + _embed_batch_tasks: Vec>, + _batch_files_task: Task<()>, + _parsing_files_tasks: Vec>, + projects: HashMap, ProjectState>, +} + +struct ProjectState { + worktree_db_ids: Vec<(WorktreeId, i64)>, + outstanding_job_count_rx: watch::Receiver, + _outstanding_job_count_tx: Arc>>, +} + +struct JobHandle { + tx: Weak>>, +} + +impl ProjectState { + fn db_id_for_worktree_id(&self, id: WorktreeId) -> Option { + self.worktree_db_ids + .iter() + .find_map(|(worktree_id, db_id)| { + if *worktree_id == id { + Some(*db_id) + } else { + None + } + }) + } + + fn worktree_id_for_db_id(&self, id: i64) -> Option { + self.worktree_db_ids + .iter() + .find_map(|(worktree_id, db_id)| { + if *db_id == id { + Some(*worktree_id) + } else { + None + } + }) + } +} + +pub struct PendingFile { + worktree_db_id: i64, + relative_path: PathBuf, + absolute_path: PathBuf, + language: Arc, + modified_time: SystemTime, + job_handle: JobHandle, +} + +pub struct SearchResult { + pub buffer: ModelHandle, + pub range: Range, +} + +enum DbOperation { + InsertFile { + worktree_id: i64, + documents: Vec, + path: PathBuf, + mtime: SystemTime, + job_handle: JobHandle, + }, + Delete { + worktree_id: i64, + path: PathBuf, + }, + FindOrCreateWorktree { + path: PathBuf, + sender: oneshot::Sender>, + }, + FileMTimes { + worktree_id: i64, + sender: oneshot::Sender>>, + }, + WorktreePreviouslyIndexed { + path: Arc, + sender: oneshot::Sender>, + }, +} + +enum EmbeddingJob { + Enqueue { + worktree_id: i64, + path: PathBuf, + mtime: SystemTime, + documents: Vec, + job_handle: JobHandle, + }, + Flush, +} + +impl SemanticIndex { + pub fn global(cx: &AppContext) -> Option> { + if cx.has_global::>() { + Some(cx.global::>().clone()) + } else { + None + } + } + + pub fn enabled(cx: &AppContext) -> bool { + settings::get::(cx).enabled + && *RELEASE_CHANNEL != ReleaseChannel::Stable + } + + async fn new( + fs: Arc, + database_url: PathBuf, + embedding_provider: Arc, + language_registry: Arc, + mut cx: AsyncAppContext, + ) -> Result> { + let t0 = Instant::now(); + let database_url = Arc::new(database_url); + + let db = cx + .background() + .spawn(VectorDatabase::new(fs.clone(), database_url.clone())) + .await?; + + log::trace!( + "db initialization took {:?} milliseconds", + t0.elapsed().as_millis() + ); + + Ok(cx.add_model(|cx| { + let t0 = Instant::now(); + // Perform database operations + let (db_update_tx, db_update_rx) = channel::unbounded(); + let _db_update_task = cx.background().spawn({ + async move { + while let Ok(job) = db_update_rx.recv().await { + Self::run_db_operation(&db, job) + } + } + }); + + // Group documents into batches and send them to the embedding provider. + let (embed_batch_tx, embed_batch_rx) = + channel::unbounded::, PathBuf, SystemTime, JobHandle)>>(); + let mut _embed_batch_tasks = Vec::new(); + for _ in 0..cx.background().num_cpus() { + let embed_batch_rx = embed_batch_rx.clone(); + _embed_batch_tasks.push(cx.background().spawn({ + let db_update_tx = db_update_tx.clone(); + let embedding_provider = embedding_provider.clone(); + async move { + while let Ok(embeddings_queue) = embed_batch_rx.recv().await { + Self::compute_embeddings_for_batch( + embeddings_queue, + &embedding_provider, + &db_update_tx, + ) + .await; + } + } + })); + } + + // Group documents into batches and send them to the embedding provider. + let (batch_files_tx, batch_files_rx) = channel::unbounded::(); + let _batch_files_task = cx.background().spawn(async move { + let mut queue_len = 0; + let mut embeddings_queue = vec![]; + while let Ok(job) = batch_files_rx.recv().await { + Self::enqueue_documents_to_embed( + job, + &mut queue_len, + &mut embeddings_queue, + &embed_batch_tx, + ); + } + }); + + // Parse files into embeddable documents. + let (parsing_files_tx, parsing_files_rx) = channel::unbounded::(); + let mut _parsing_files_tasks = Vec::new(); + for _ in 0..cx.background().num_cpus() { + let fs = fs.clone(); + let parsing_files_rx = parsing_files_rx.clone(); + let batch_files_tx = batch_files_tx.clone(); + let db_update_tx = db_update_tx.clone(); + _parsing_files_tasks.push(cx.background().spawn(async move { + let mut retriever = CodeContextRetriever::new(); + while let Ok(pending_file) = parsing_files_rx.recv().await { + Self::parse_file( + &fs, + pending_file, + &mut retriever, + &batch_files_tx, + &parsing_files_rx, + &db_update_tx, + ) + .await; + } + })); + } + + log::trace!( + "semantic index task initialization took {:?} milliseconds", + t0.elapsed().as_millis() + ); + Self { + fs, + database_url, + embedding_provider, + language_registry, + db_update_tx, + parsing_files_tx, + _db_update_task, + _embed_batch_tasks, + _batch_files_task, + _parsing_files_tasks, + projects: HashMap::new(), + } + })) + } + + fn run_db_operation(db: &VectorDatabase, job: DbOperation) { + match job { + DbOperation::InsertFile { + worktree_id, + documents, + path, + mtime, + job_handle, + } => { + db.insert_file(worktree_id, path, mtime, documents) + .log_err(); + drop(job_handle) + } + DbOperation::Delete { worktree_id, path } => { + db.delete_file(worktree_id, path).log_err(); + } + DbOperation::FindOrCreateWorktree { path, sender } => { + let id = db.find_or_create_worktree(&path); + sender.send(id).ok(); + } + DbOperation::FileMTimes { + worktree_id: worktree_db_id, + sender, + } => { + let file_mtimes = db.get_file_mtimes(worktree_db_id); + sender.send(file_mtimes).ok(); + } + DbOperation::WorktreePreviouslyIndexed { path, sender } => { + let worktree_indexed = db.worktree_previously_indexed(path.as_ref()); + sender.send(worktree_indexed).ok(); + } + } + } + + async fn compute_embeddings_for_batch( + mut embeddings_queue: Vec<(i64, Vec, PathBuf, SystemTime, JobHandle)>, + embedding_provider: &Arc, + db_update_tx: &channel::Sender, + ) { + let mut batch_documents = vec![]; + for (_, documents, _, _, _) in embeddings_queue.iter() { + batch_documents.extend(documents.iter().map(|document| document.content.as_str())); + } + + if let Ok(embeddings) = embedding_provider.embed_batch(batch_documents).await { + log::trace!( + "created {} embeddings for {} files", + embeddings.len(), + embeddings_queue.len(), + ); + + let mut i = 0; + let mut j = 0; + + for embedding in embeddings.iter() { + while embeddings_queue[i].1.len() == j { + i += 1; + j = 0; + } + + embeddings_queue[i].1[j].embedding = embedding.to_owned(); + j += 1; + } + + for (worktree_id, documents, path, mtime, job_handle) in embeddings_queue.into_iter() { + db_update_tx + .send(DbOperation::InsertFile { + worktree_id, + documents, + path, + mtime, + job_handle, + }) + .await + .unwrap(); + } + } + } + + fn enqueue_documents_to_embed( + job: EmbeddingJob, + queue_len: &mut usize, + embeddings_queue: &mut Vec<(i64, Vec, PathBuf, SystemTime, JobHandle)>, + embed_batch_tx: &channel::Sender, PathBuf, SystemTime, JobHandle)>>, + ) { + let should_flush = match job { + EmbeddingJob::Enqueue { + documents, + worktree_id, + path, + mtime, + job_handle, + } => { + *queue_len += &documents.len(); + embeddings_queue.push((worktree_id, documents, path, mtime, job_handle)); + *queue_len >= EMBEDDINGS_BATCH_SIZE + } + EmbeddingJob::Flush => true, + }; + + if should_flush { + embed_batch_tx + .try_send(mem::take(embeddings_queue)) + .unwrap(); + *queue_len = 0; + } + } + + async fn parse_file( + fs: &Arc, + pending_file: PendingFile, + retriever: &mut CodeContextRetriever, + batch_files_tx: &channel::Sender, + parsing_files_rx: &channel::Receiver, + db_update_tx: &channel::Sender, + ) { + if let Some(content) = fs.load(&pending_file.absolute_path).await.log_err() { + if let Some(documents) = retriever + .parse_file_with_template( + &pending_file.relative_path, + &content, + pending_file.language, + ) + .log_err() + { + log::trace!( + "parsed path {:?}: {} documents", + pending_file.relative_path, + documents.len() + ); + + if documents.len() == 0 { + db_update_tx + .send(DbOperation::InsertFile { + worktree_id: pending_file.worktree_db_id, + documents, + path: pending_file.relative_path, + mtime: pending_file.modified_time, + job_handle: pending_file.job_handle, + }) + .await + .unwrap(); + } else { + batch_files_tx + .try_send(EmbeddingJob::Enqueue { + worktree_id: pending_file.worktree_db_id, + path: pending_file.relative_path, + mtime: pending_file.modified_time, + job_handle: pending_file.job_handle, + documents, + }) + .unwrap(); + } + } + } + + if parsing_files_rx.len() == 0 { + batch_files_tx.try_send(EmbeddingJob::Flush).unwrap(); + } + } + + fn find_or_create_worktree(&self, path: PathBuf) -> impl Future> { + let (tx, rx) = oneshot::channel(); + self.db_update_tx + .try_send(DbOperation::FindOrCreateWorktree { path, sender: tx }) + .unwrap(); + async move { rx.await? } + } + + fn get_file_mtimes( + &self, + worktree_id: i64, + ) -> impl Future>> { + let (tx, rx) = oneshot::channel(); + self.db_update_tx + .try_send(DbOperation::FileMTimes { + worktree_id, + sender: tx, + }) + .unwrap(); + async move { rx.await? } + } + + fn worktree_previously_indexed(&self, path: Arc) -> impl Future> { + let (tx, rx) = oneshot::channel(); + self.db_update_tx + .try_send(DbOperation::WorktreePreviouslyIndexed { path, sender: tx }) + .unwrap(); + async move { rx.await? } + } + + pub fn project_previously_indexed( + &mut self, + project: ModelHandle, + cx: &mut ModelContext, + ) -> Task> { + let worktree_scans_complete = project + .read(cx) + .worktrees(cx) + .map(|worktree| { + let scan_complete = worktree.read(cx).as_local().unwrap().scan_complete(); + async move { + scan_complete.await; + } + }) + .collect::>(); + + let worktrees_indexed_previously = project + .read(cx) + .worktrees(cx) + .map(|worktree| self.worktree_previously_indexed(worktree.read(cx).abs_path())) + .collect::>(); + + cx.spawn(|_, _cx| async move { + futures::future::join_all(worktree_scans_complete).await; + + let worktree_indexed_previously = + futures::future::join_all(worktrees_indexed_previously).await; + + Ok(worktree_indexed_previously + .iter() + .filter(|worktree| worktree.is_ok()) + .all(|v| v.as_ref().log_err().is_some_and(|v| v.to_owned()))) + }) + } + + pub fn index_project( + &mut self, + project: ModelHandle, + cx: &mut ModelContext, + ) -> Task)>> { + let t0 = Instant::now(); + let worktree_scans_complete = project + .read(cx) + .worktrees(cx) + .map(|worktree| { + let scan_complete = worktree.read(cx).as_local().unwrap().scan_complete(); + async move { + scan_complete.await; + } + }) + .collect::>(); + let worktree_db_ids = project + .read(cx) + .worktrees(cx) + .map(|worktree| { + self.find_or_create_worktree(worktree.read(cx).abs_path().to_path_buf()) + }) + .collect::>(); + + let language_registry = self.language_registry.clone(); + let db_update_tx = self.db_update_tx.clone(); + let parsing_files_tx = self.parsing_files_tx.clone(); + + cx.spawn(|this, mut cx| async move { + futures::future::join_all(worktree_scans_complete).await; + + let worktree_db_ids = futures::future::join_all(worktree_db_ids).await; + + let worktrees = project.read_with(&cx, |project, cx| { + project + .worktrees(cx) + .map(|worktree| worktree.read(cx).snapshot()) + .collect::>() + }); + + let mut worktree_file_mtimes = HashMap::new(); + let mut db_ids_by_worktree_id = HashMap::new(); + for (worktree, db_id) in worktrees.iter().zip(worktree_db_ids) { + let db_id = db_id?; + db_ids_by_worktree_id.insert(worktree.id(), db_id); + worktree_file_mtimes.insert( + worktree.id(), + this.read_with(&cx, |this, _| this.get_file_mtimes(db_id)) + .await?, + ); + } + + let (job_count_tx, job_count_rx) = watch::channel_with(0); + let job_count_tx = Arc::new(Mutex::new(job_count_tx)); + this.update(&mut cx, |this, _| { + this.projects.insert( + project.downgrade(), + ProjectState { + worktree_db_ids: db_ids_by_worktree_id + .iter() + .map(|(a, b)| (*a, *b)) + .collect(), + outstanding_job_count_rx: job_count_rx.clone(), + _outstanding_job_count_tx: job_count_tx.clone(), + }, + ); + }); + + cx.background() + .spawn(async move { + let mut count = 0; + for worktree in worktrees.into_iter() { + let mut file_mtimes = worktree_file_mtimes.remove(&worktree.id()).unwrap(); + for file in worktree.files(false, 0) { + let absolute_path = worktree.absolutize(&file.path); + + if let Ok(language) = language_registry + .language_for_file(&absolute_path, None) + .await + { + if !PARSEABLE_ENTIRE_FILE_TYPES.contains(&language.name().as_ref()) + && language + .grammar() + .and_then(|grammar| grammar.embedding_config.as_ref()) + .is_none() + { + continue; + } + + let path_buf = file.path.to_path_buf(); + let stored_mtime = file_mtimes.remove(&file.path.to_path_buf()); + let already_stored = stored_mtime + .map_or(false, |existing_mtime| existing_mtime == file.mtime); + + if !already_stored { + count += 1; + *job_count_tx.lock().borrow_mut() += 1; + let job_handle = JobHandle { + tx: Arc::downgrade(&job_count_tx), + }; + parsing_files_tx + .try_send(PendingFile { + worktree_db_id: db_ids_by_worktree_id[&worktree.id()], + relative_path: path_buf, + absolute_path, + language, + job_handle, + modified_time: file.mtime, + }) + .unwrap(); + } + } + } + for file in file_mtimes.keys() { + db_update_tx + .try_send(DbOperation::Delete { + worktree_id: db_ids_by_worktree_id[&worktree.id()], + path: file.to_owned(), + }) + .unwrap(); + } + } + + log::trace!( + "walking worktree took {:?} milliseconds", + t0.elapsed().as_millis() + ); + anyhow::Ok((count, job_count_rx)) + }) + .await + }) + } + + pub fn outstanding_job_count_rx( + &self, + project: &ModelHandle, + ) -> Option> { + Some( + self.projects + .get(&project.downgrade())? + .outstanding_job_count_rx + .clone(), + ) + } + + pub fn search_project( + &mut self, + project: ModelHandle, + phrase: String, + limit: usize, + include_globs: Vec, + exclude_globs: Vec, + cx: &mut ModelContext, + ) -> Task>> { + let project_state = if let Some(state) = self.projects.get(&project.downgrade()) { + state + } else { + return Task::ready(Err(anyhow!("project not added"))); + }; + + let worktree_db_ids = project + .read(cx) + .worktrees(cx) + .filter_map(|worktree| { + let worktree_id = worktree.read(cx).id(); + project_state.db_id_for_worktree_id(worktree_id) + }) + .collect::>(); + + let embedding_provider = self.embedding_provider.clone(); + let database_url = self.database_url.clone(); + let fs = self.fs.clone(); + cx.spawn(|this, mut cx| async move { + let documents = cx + .background() + .spawn(async move { + let database = VectorDatabase::new(fs, database_url).await?; + + let phrase_embedding = embedding_provider + .embed_batch(vec![&phrase]) + .await? + .into_iter() + .next() + .unwrap(); + + database.top_k_search( + &worktree_db_ids, + &phrase_embedding, + limit, + include_globs, + exclude_globs, + ) + }) + .await?; + + let mut tasks = Vec::new(); + let mut ranges = Vec::new(); + let weak_project = project.downgrade(); + project.update(&mut cx, |project, cx| { + for (worktree_db_id, file_path, byte_range) in documents { + let project_state = + if let Some(state) = this.read(cx).projects.get(&weak_project) { + state + } else { + return Err(anyhow!("project not added")); + }; + if let Some(worktree_id) = project_state.worktree_id_for_db_id(worktree_db_id) { + tasks.push(project.open_buffer((worktree_id, file_path), cx)); + ranges.push(byte_range); + } + } + + Ok(()) + })?; + + let buffers = futures::future::join_all(tasks).await; + + Ok(buffers + .into_iter() + .zip(ranges) + .filter_map(|(buffer, range)| { + let buffer = buffer.log_err()?; + let range = buffer.read_with(&cx, |buffer, _| { + buffer.anchor_before(range.start)..buffer.anchor_after(range.end) + }); + Some(SearchResult { buffer, range }) + }) + .collect::>()) + }) + } +} + +impl Entity for SemanticIndex { + type Event = (); +} + +impl Drop for JobHandle { + fn drop(&mut self) { + if let Some(tx) = self.tx.upgrade() { + let mut tx = tx.lock(); + *tx.borrow_mut() -= 1; + } + } +} diff --git a/crates/vector_store/src/vector_store_settings.rs b/crates/semantic_index/src/semantic_index_settings.rs similarity index 71% rename from crates/vector_store/src/vector_store_settings.rs rename to crates/semantic_index/src/semantic_index_settings.rs index e1fa7cc05a362829fae1a361097740d04b115b6c..86872457f841e1bfe1b601d1fb6d5d86a12911dc 100644 --- a/crates/vector_store/src/vector_store_settings.rs +++ b/crates/semantic_index/src/semantic_index_settings.rs @@ -4,21 +4,21 @@ use serde::{Deserialize, Serialize}; use settings::Setting; #[derive(Deserialize, Debug)] -pub struct VectorStoreSettings { +pub struct SemanticIndexSettings { pub enabled: bool, pub reindexing_delay_seconds: usize, } #[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)] -pub struct VectorStoreSettingsContent { +pub struct SemanticIndexSettingsContent { pub enabled: Option, pub reindexing_delay_seconds: Option, } -impl Setting for VectorStoreSettings { - const KEY: Option<&'static str> = Some("vector_store"); +impl Setting for SemanticIndexSettings { + const KEY: Option<&'static str> = Some("semantic_index"); - type FileContent = VectorStoreSettingsContent; + type FileContent = SemanticIndexSettingsContent; fn load( default_value: &Self::FileContent, diff --git a/crates/semantic_index/src/semantic_index_tests.rs b/crates/semantic_index/src/semantic_index_tests.rs new file mode 100644 index 0000000000000000000000000000000000000000..acf5a9d72b43a1123102e105da2b4b039fba87c6 --- /dev/null +++ b/crates/semantic_index/src/semantic_index_tests.rs @@ -0,0 +1,1142 @@ +use crate::{ + db::dot, + embedding::EmbeddingProvider, + parsing::{subtract_ranges, CodeContextRetriever, Document}, + semantic_index_settings::SemanticIndexSettings, + SearchResult, SemanticIndex, +}; +use anyhow::Result; +use async_trait::async_trait; +use globset::Glob; +use gpui::{Task, TestAppContext}; +use language::{Language, LanguageConfig, LanguageRegistry, ToOffset}; +use pretty_assertions::assert_eq; +use project::{project_settings::ProjectSettings, FakeFs, Fs, Project}; +use rand::{rngs::StdRng, Rng}; +use serde_json::json; +use settings::SettingsStore; +use std::{ + path::Path, + sync::{ + atomic::{self, AtomicUsize}, + Arc, + }, +}; +use unindent::Unindent; + +#[ctor::ctor] +fn init_logger() { + if std::env::var("RUST_LOG").is_ok() { + env_logger::init(); + } +} + +#[gpui::test] +async fn test_semantic_index(cx: &mut TestAppContext) { + cx.update(|cx| { + cx.set_global(SettingsStore::test(cx)); + settings::register::(cx); + settings::register::(cx); + }); + + let fs = FakeFs::new(cx.background()); + fs.insert_tree( + "/the-root", + json!({ + "src": { + "file1.rs": " + fn aaa() { + println!(\"aaaaaaaaaaaa!\"); + } + + fn zzzzz() { + println!(\"SLEEPING\"); + } + ".unindent(), + "file2.rs": " + fn bbb() { + println!(\"bbbbbbbbbbbbb!\"); + } + ".unindent(), + "file3.toml": " + ZZZZZZZZZZZZZZZZZZ = 5 + ".unindent(), + } + }), + ) + .await; + + let languages = Arc::new(LanguageRegistry::new(Task::ready(()))); + let rust_language = rust_lang(); + let toml_language = toml_lang(); + languages.add(rust_language); + languages.add(toml_language); + + let db_dir = tempdir::TempDir::new("vector-store").unwrap(); + let db_path = db_dir.path().join("db.sqlite"); + + let embedding_provider = Arc::new(FakeEmbeddingProvider::default()); + let store = SemanticIndex::new( + fs.clone(), + db_path, + embedding_provider.clone(), + languages, + cx.to_async(), + ) + .await + .unwrap(); + + let project = Project::test(fs.clone(), ["/the-root".as_ref()], cx).await; + let (file_count, outstanding_file_count) = store + .update(cx, |store, cx| store.index_project(project.clone(), cx)) + .await + .unwrap(); + assert_eq!(file_count, 3); + cx.foreground().run_until_parked(); + assert_eq!(*outstanding_file_count.borrow(), 0); + + let search_results = store + .update(cx, |store, cx| { + store.search_project( + project.clone(), + "aaaaaabbbbzz".to_string(), + 5, + vec![], + vec![], + cx, + ) + }) + .await + .unwrap(); + + assert_search_results( + &search_results, + &[ + (Path::new("src/file1.rs").into(), 0), + (Path::new("src/file2.rs").into(), 0), + (Path::new("src/file3.toml").into(), 0), + (Path::new("src/file1.rs").into(), 45), + ], + cx, + ); + + // Test Include Files Functonality + let include_files = vec![Glob::new("*.rs").unwrap().compile_matcher()]; + let exclude_files = vec![Glob::new("*.rs").unwrap().compile_matcher()]; + let rust_only_search_results = store + .update(cx, |store, cx| { + store.search_project( + project.clone(), + "aaaaaabbbbzz".to_string(), + 5, + include_files, + vec![], + cx, + ) + }) + .await + .unwrap(); + + assert_search_results( + &rust_only_search_results, + &[ + (Path::new("src/file1.rs").into(), 0), + (Path::new("src/file2.rs").into(), 0), + (Path::new("src/file1.rs").into(), 45), + ], + cx, + ); + + let no_rust_search_results = store + .update(cx, |store, cx| { + store.search_project( + project.clone(), + "aaaaaabbbbzz".to_string(), + 5, + vec![], + exclude_files, + cx, + ) + }) + .await + .unwrap(); + + assert_search_results( + &no_rust_search_results, + &[(Path::new("src/file3.toml").into(), 0)], + cx, + ); + + fs.save( + "/the-root/src/file2.rs".as_ref(), + &" + fn dddd() { println!(\"ddddd!\"); } + struct pqpqpqp {} + " + .unindent() + .into(), + Default::default(), + ) + .await + .unwrap(); + + cx.foreground().run_until_parked(); + + let prev_embedding_count = embedding_provider.embedding_count(); + let (file_count, outstanding_file_count) = store + .update(cx, |store, cx| store.index_project(project.clone(), cx)) + .await + .unwrap(); + assert_eq!(file_count, 1); + + cx.foreground().run_until_parked(); + assert_eq!(*outstanding_file_count.borrow(), 0); + + assert_eq!( + embedding_provider.embedding_count() - prev_embedding_count, + 2 + ); +} + +#[track_caller] +fn assert_search_results( + actual: &[SearchResult], + expected: &[(Arc, usize)], + cx: &TestAppContext, +) { + let actual = actual + .iter() + .map(|search_result| { + search_result.buffer.read_with(cx, |buffer, _cx| { + ( + buffer.file().unwrap().path().clone(), + search_result.range.start.to_offset(buffer), + ) + }) + }) + .collect::>(); + assert_eq!(actual, expected); +} + +#[gpui::test] +async fn test_code_context_retrieval_rust() { + let language = rust_lang(); + let mut retriever = CodeContextRetriever::new(); + + let text = " + /// A doc comment + /// that spans multiple lines + #[gpui::test] + fn a() { + b + } + + impl C for D { + } + + impl E { + // This is also a preceding comment + pub fn function_1() -> Option<()> { + todo!(); + } + + // This is a preceding comment + fn function_2() -> Result<()> { + todo!(); + } + } + " + .unindent(); + + let documents = retriever.parse_file(&text, language).unwrap(); + + assert_documents_eq( + &documents, + &[ + ( + " + /// A doc comment + /// that spans multiple lines + #[gpui::test] + fn a() { + b + }" + .unindent(), + text.find("fn a").unwrap(), + ), + ( + " + impl C for D { + }" + .unindent(), + text.find("impl C").unwrap(), + ), + ( + " + impl E { + // This is also a preceding comment + pub fn function_1() -> Option<()> { /* ... */ } + + // This is a preceding comment + fn function_2() -> Result<()> { /* ... */ } + }" + .unindent(), + text.find("impl E").unwrap(), + ), + ( + " + // This is also a preceding comment + pub fn function_1() -> Option<()> { + todo!(); + }" + .unindent(), + text.find("pub fn function_1").unwrap(), + ), + ( + " + // This is a preceding comment + fn function_2() -> Result<()> { + todo!(); + }" + .unindent(), + text.find("fn function_2").unwrap(), + ), + ], + ); +} + +#[gpui::test] +async fn test_code_context_retrieval_json() { + let language = json_lang(); + let mut retriever = CodeContextRetriever::new(); + + let text = r#" + { + "array": [1, 2, 3, 4], + "string": "abcdefg", + "nested_object": { + "array_2": [5, 6, 7, 8], + "string_2": "hijklmnop", + "boolean": true, + "none": null + } + } + "# + .unindent(); + + let documents = retriever.parse_file(&text, language.clone()).unwrap(); + + assert_documents_eq( + &documents, + &[( + r#" + { + "array": [], + "string": "", + "nested_object": { + "array_2": [], + "string_2": "", + "boolean": true, + "none": null + } + }"# + .unindent(), + text.find("{").unwrap(), + )], + ); + + let text = r#" + [ + { + "name": "somebody", + "age": 42 + }, + { + "name": "somebody else", + "age": 43 + } + ] + "# + .unindent(); + + let documents = retriever.parse_file(&text, language.clone()).unwrap(); + + assert_documents_eq( + &documents, + &[( + r#" + [{ + "name": "", + "age": 42 + }]"# + .unindent(), + text.find("[").unwrap(), + )], + ); +} + +fn assert_documents_eq( + documents: &[Document], + expected_contents_and_start_offsets: &[(String, usize)], +) { + assert_eq!( + documents + .iter() + .map(|document| (document.content.clone(), document.range.start)) + .collect::>(), + expected_contents_and_start_offsets + ); +} + +#[gpui::test] +async fn test_code_context_retrieval_javascript() { + let language = js_lang(); + let mut retriever = CodeContextRetriever::new(); + + let text = " + /* globals importScripts, backend */ + function _authorize() {} + + /** + * Sometimes the frontend build is way faster than backend. + */ + export async function authorizeBank() { + _authorize(pushModal, upgradingAccountId, {}); + } + + export class SettingsPage { + /* This is a test setting */ + constructor(page) { + this.page = page; + } + } + + /* This is a test comment */ + class TestClass {} + + /* Schema for editor_events in Clickhouse. */ + export interface ClickhouseEditorEvent { + installation_id: string + operation: string + } + " + .unindent(); + + let documents = retriever.parse_file(&text, language.clone()).unwrap(); + + assert_documents_eq( + &documents, + &[ + ( + " + /* globals importScripts, backend */ + function _authorize() {}" + .unindent(), + 37, + ), + ( + " + /** + * Sometimes the frontend build is way faster than backend. + */ + export async function authorizeBank() { + _authorize(pushModal, upgradingAccountId, {}); + }" + .unindent(), + 131, + ), + ( + " + export class SettingsPage { + /* This is a test setting */ + constructor(page) { + this.page = page; + } + }" + .unindent(), + 225, + ), + ( + " + /* This is a test setting */ + constructor(page) { + this.page = page; + }" + .unindent(), + 290, + ), + ( + " + /* This is a test comment */ + class TestClass {}" + .unindent(), + 374, + ), + ( + " + /* Schema for editor_events in Clickhouse. */ + export interface ClickhouseEditorEvent { + installation_id: string + operation: string + }" + .unindent(), + 440, + ), + ], + ) +} + +#[gpui::test] +async fn test_code_context_retrieval_elixir() { + let language = elixir_lang(); + let mut retriever = CodeContextRetriever::new(); + + let text = r#" + defmodule File.Stream do + @moduledoc """ + Defines a `File.Stream` struct returned by `File.stream!/3`. + + The following fields are public: + + * `path` - the file path + * `modes` - the file modes + * `raw` - a boolean indicating if bin functions should be used + * `line_or_bytes` - if reading should read lines or a given number of bytes + * `node` - the node the file belongs to + + """ + + defstruct path: nil, modes: [], line_or_bytes: :line, raw: true, node: nil + + @type t :: %__MODULE__{} + + @doc false + def __build__(path, modes, line_or_bytes) do + raw = :lists.keyfind(:encoding, 1, modes) == false + + modes = + case raw do + true -> + case :lists.keyfind(:read_ahead, 1, modes) do + {:read_ahead, false} -> [:raw | :lists.keydelete(:read_ahead, 1, modes)] + {:read_ahead, _} -> [:raw | modes] + false -> [:raw, :read_ahead | modes] + end + + false -> + modes + end + + %File.Stream{path: path, modes: modes, raw: raw, line_or_bytes: line_or_bytes, node: node()} + + end"# + .unindent(); + + let documents = retriever.parse_file(&text, language.clone()).unwrap(); + + assert_documents_eq( + &documents, + &[( + r#" + defmodule File.Stream do + @moduledoc """ + Defines a `File.Stream` struct returned by `File.stream!/3`. + + The following fields are public: + + * `path` - the file path + * `modes` - the file modes + * `raw` - a boolean indicating if bin functions should be used + * `line_or_bytes` - if reading should read lines or a given number of bytes + * `node` - the node the file belongs to + + """ + + defstruct path: nil, modes: [], line_or_bytes: :line, raw: true, node: nil + + @type t :: %__MODULE__{} + + @doc false + def __build__(path, modes, line_or_bytes) do + raw = :lists.keyfind(:encoding, 1, modes) == false + + modes = + case raw do + true -> + case :lists.keyfind(:read_ahead, 1, modes) do + {:read_ahead, false} -> [:raw | :lists.keydelete(:read_ahead, 1, modes)] + {:read_ahead, _} -> [:raw | modes] + false -> [:raw, :read_ahead | modes] + end + + false -> + modes + end + + %File.Stream{path: path, modes: modes, raw: raw, line_or_bytes: line_or_bytes, node: node()} + + end"# + .unindent(), + 0, + ),(r#" + @doc false + def __build__(path, modes, line_or_bytes) do + raw = :lists.keyfind(:encoding, 1, modes) == false + + modes = + case raw do + true -> + case :lists.keyfind(:read_ahead, 1, modes) do + {:read_ahead, false} -> [:raw | :lists.keydelete(:read_ahead, 1, modes)] + {:read_ahead, _} -> [:raw | modes] + false -> [:raw, :read_ahead | modes] + end + + false -> + modes + end + + %File.Stream{path: path, modes: modes, raw: raw, line_or_bytes: line_or_bytes, node: node()} + + end"#.unindent(), 574)], + ); +} + +#[gpui::test] +async fn test_code_context_retrieval_cpp() { + let language = cpp_lang(); + let mut retriever = CodeContextRetriever::new(); + + let text = " + /** + * @brief Main function + * @returns 0 on exit + */ + int main() { return 0; } + + /** + * This is a test comment + */ + class MyClass { // The class + public: // Access specifier + int myNum; // Attribute (int variable) + string myString; // Attribute (string variable) + }; + + // This is a test comment + enum Color { red, green, blue }; + + /** This is a preceding block comment + * This is the second line + */ + struct { // Structure declaration + int myNum; // Member (int variable) + string myString; // Member (string variable) + } myStructure; + + /** + * @brief Matrix class. + */ + template ::value || std::is_floating_point::value, + bool>::type> + class Matrix2 { + std::vector> _mat; + + public: + /** + * @brief Constructor + * @tparam Integer ensuring integers are being evaluated and not other + * data types. + * @param size denoting the size of Matrix as size x size + */ + template ::value, + Integer>::type> + explicit Matrix(const Integer size) { + for (size_t i = 0; i < size; ++i) { + _mat.emplace_back(std::vector(size, 0)); + } + } + }" + .unindent(); + + let documents = retriever.parse_file(&text, language.clone()).unwrap(); + + assert_documents_eq( + &documents, + &[ + ( + " + /** + * @brief Main function + * @returns 0 on exit + */ + int main() { return 0; }" + .unindent(), + 54, + ), + ( + " + /** + * This is a test comment + */ + class MyClass { // The class + public: // Access specifier + int myNum; // Attribute (int variable) + string myString; // Attribute (string variable) + }" + .unindent(), + 112, + ), + ( + " + // This is a test comment + enum Color { red, green, blue }" + .unindent(), + 322, + ), + ( + " + /** This is a preceding block comment + * This is the second line + */ + struct { // Structure declaration + int myNum; // Member (int variable) + string myString; // Member (string variable) + } myStructure;" + .unindent(), + 425, + ), + ( + " + /** + * @brief Matrix class. + */ + template ::value || std::is_floating_point::value, + bool>::type> + class Matrix2 { + std::vector> _mat; + + public: + /** + * @brief Constructor + * @tparam Integer ensuring integers are being evaluated and not other + * data types. + * @param size denoting the size of Matrix as size x size + */ + template ::value, + Integer>::type> + explicit Matrix(const Integer size) { + for (size_t i = 0; i < size; ++i) { + _mat.emplace_back(std::vector(size, 0)); + } + } + }" + .unindent(), + 612, + ), + ( + " + explicit Matrix(const Integer size) { + for (size_t i = 0; i < size; ++i) { + _mat.emplace_back(std::vector(size, 0)); + } + }" + .unindent(), + 1226, + ), + ], + ); +} + +#[gpui::test] +fn test_dot_product(mut rng: StdRng) { + assert_eq!(dot(&[1., 0., 0., 0., 0.], &[0., 1., 0., 0., 0.]), 0.); + assert_eq!(dot(&[2., 0., 0., 0., 0.], &[3., 1., 0., 0., 0.]), 6.); + + for _ in 0..100 { + let size = 1536; + let mut a = vec![0.; size]; + let mut b = vec![0.; size]; + for (a, b) in a.iter_mut().zip(b.iter_mut()) { + *a = rng.gen(); + *b = rng.gen(); + } + + assert_eq!( + round_to_decimals(dot(&a, &b), 1), + round_to_decimals(reference_dot(&a, &b), 1) + ); + } + + fn round_to_decimals(n: f32, decimal_places: i32) -> f32 { + let factor = (10.0 as f32).powi(decimal_places); + (n * factor).round() / factor + } + + fn reference_dot(a: &[f32], b: &[f32]) -> f32 { + a.iter().zip(b.iter()).map(|(a, b)| a * b).sum() + } +} + +#[derive(Default)] +struct FakeEmbeddingProvider { + embedding_count: AtomicUsize, +} + +impl FakeEmbeddingProvider { + fn embedding_count(&self) -> usize { + self.embedding_count.load(atomic::Ordering::SeqCst) + } +} + +#[async_trait] +impl EmbeddingProvider for FakeEmbeddingProvider { + async fn embed_batch(&self, spans: Vec<&str>) -> Result>> { + self.embedding_count + .fetch_add(spans.len(), atomic::Ordering::SeqCst); + Ok(spans + .iter() + .map(|span| { + let mut result = vec![1.0; 26]; + for letter in span.chars() { + let letter = letter.to_ascii_lowercase(); + if letter as u32 >= 'a' as u32 { + let ix = (letter as u32) - ('a' as u32); + if ix < 26 { + result[ix as usize] += 1.0; + } + } + } + + let norm = result.iter().map(|x| x * x).sum::().sqrt(); + for x in &mut result { + *x /= norm; + } + + result + }) + .collect()) + } +} + +fn js_lang() -> Arc { + Arc::new( + Language::new( + LanguageConfig { + name: "Javascript".into(), + path_suffixes: vec!["js".into()], + ..Default::default() + }, + Some(tree_sitter_typescript::language_tsx()), + ) + .with_embedding_query( + &r#" + + ( + (comment)* @context + . + [ + (export_statement + (function_declaration + "async"? @name + "function" @name + name: (_) @name)) + (function_declaration + "async"? @name + "function" @name + name: (_) @name) + ] @item + ) + + ( + (comment)* @context + . + [ + (export_statement + (class_declaration + "class" @name + name: (_) @name)) + (class_declaration + "class" @name + name: (_) @name) + ] @item + ) + + ( + (comment)* @context + . + [ + (export_statement + (interface_declaration + "interface" @name + name: (_) @name)) + (interface_declaration + "interface" @name + name: (_) @name) + ] @item + ) + + ( + (comment)* @context + . + [ + (export_statement + (enum_declaration + "enum" @name + name: (_) @name)) + (enum_declaration + "enum" @name + name: (_) @name) + ] @item + ) + + ( + (comment)* @context + . + (method_definition + [ + "get" + "set" + "async" + "*" + "static" + ]* @name + name: (_) @name) @item + ) + + "# + .unindent(), + ) + .unwrap(), + ) +} + +fn rust_lang() -> Arc { + Arc::new( + Language::new( + LanguageConfig { + name: "Rust".into(), + path_suffixes: vec!["rs".into()], + collapsed_placeholder: " /* ... */ ".to_string(), + ..Default::default() + }, + Some(tree_sitter_rust::language()), + ) + .with_embedding_query( + r#" + ( + [(line_comment) (attribute_item)]* @context + . + [ + (struct_item + name: (_) @name) + + (enum_item + name: (_) @name) + + (impl_item + trait: (_)? @name + "for"? @name + type: (_) @name) + + (trait_item + name: (_) @name) + + (function_item + name: (_) @name + body: (block + "{" @keep + "}" @keep) @collapse) + + (macro_definition + name: (_) @name) + ] @item + ) + "#, + ) + .unwrap(), + ) +} + +fn json_lang() -> Arc { + Arc::new( + Language::new( + LanguageConfig { + name: "JSON".into(), + path_suffixes: vec!["json".into()], + ..Default::default() + }, + Some(tree_sitter_json::language()), + ) + .with_embedding_query( + r#" + (document) @item + + (array + "[" @keep + . + (object)? @keep + "]" @keep) @collapse + + (pair value: (string + "\"" @keep + "\"" @keep) @collapse) + "#, + ) + .unwrap(), + ) +} + +fn toml_lang() -> Arc { + Arc::new(Language::new( + LanguageConfig { + name: "TOML".into(), + path_suffixes: vec!["toml".into()], + ..Default::default() + }, + Some(tree_sitter_toml::language()), + )) +} + +fn cpp_lang() -> Arc { + Arc::new( + Language::new( + LanguageConfig { + name: "CPP".into(), + path_suffixes: vec!["cpp".into()], + ..Default::default() + }, + Some(tree_sitter_cpp::language()), + ) + .with_embedding_query( + r#" + ( + (comment)* @context + . + (function_definition + (type_qualifier)? @name + type: (_)? @name + declarator: [ + (function_declarator + declarator: (_) @name) + (pointer_declarator + "*" @name + declarator: (function_declarator + declarator: (_) @name)) + (pointer_declarator + "*" @name + declarator: (pointer_declarator + "*" @name + declarator: (function_declarator + declarator: (_) @name))) + (reference_declarator + ["&" "&&"] @name + (function_declarator + declarator: (_) @name)) + ] + (type_qualifier)? @name) @item + ) + + ( + (comment)* @context + . + (template_declaration + (class_specifier + "class" @name + name: (_) @name) + ) @item + ) + + ( + (comment)* @context + . + (class_specifier + "class" @name + name: (_) @name) @item + ) + + ( + (comment)* @context + . + (enum_specifier + "enum" @name + name: (_) @name) @item + ) + + ( + (comment)* @context + . + (declaration + type: (struct_specifier + "struct" @name) + declarator: (_) @name) @item + ) + + "#, + ) + .unwrap(), + ) +} + +fn elixir_lang() -> Arc { + Arc::new( + Language::new( + LanguageConfig { + name: "Elixir".into(), + path_suffixes: vec!["rs".into()], + ..Default::default() + }, + Some(tree_sitter_elixir::language()), + ) + .with_embedding_query( + r#" + ( + (unary_operator + operator: "@" + operand: (call + target: (identifier) @unary + (#match? @unary "^(doc)$")) + ) @context + . + (call + target: (identifier) @name + (arguments + [ + (identifier) @name + (call + target: (identifier) @name) + (binary_operator + left: (call + target: (identifier) @name) + operator: "when") + ]) + (#match? @name "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp)$")) @item + ) + + (call + target: (identifier) @name + (arguments (alias) @name) + (#match? @name "^(defmodule|defprotocol)$")) @item + "#, + ) + .unwrap(), + ) +} + +#[gpui::test] +fn test_subtract_ranges() { + // collapsed_ranges: Vec>, keep_ranges: Vec> + + assert_eq!( + subtract_ranges(&[0..5, 10..21], &[0..1, 4..5]), + vec![1..4, 10..21] + ); + + assert_eq!(subtract_ranges(&[0..5], &[1..2]), &[0..1, 2..5]); +} diff --git a/crates/vector_store/src/modal.rs b/crates/vector_store/src/modal.rs deleted file mode 100644 index 0116f1d2e509020da3dc7d8d64f102fbaf5ec222..0000000000000000000000000000000000000000 --- a/crates/vector_store/src/modal.rs +++ /dev/null @@ -1,172 +0,0 @@ -use crate::{SearchResult, VectorStore}; -use editor::{scroll::autoscroll::Autoscroll, Editor}; -use gpui::{ - actions, elements::*, AnyElement, AppContext, ModelHandle, MouseState, Task, ViewContext, - WeakViewHandle, -}; -use picker::{Picker, PickerDelegate, PickerEvent}; -use project::{Project, ProjectPath}; -use std::{collections::HashMap, sync::Arc, time::Duration}; -use util::ResultExt; -use workspace::Workspace; - -const MIN_QUERY_LEN: usize = 5; -const EMBEDDING_DEBOUNCE_INTERVAL: Duration = Duration::from_millis(500); - -actions!(semantic_search, [Toggle]); - -pub type SemanticSearch = Picker; - -pub struct SemanticSearchDelegate { - workspace: WeakViewHandle, - project: ModelHandle, - vector_store: ModelHandle, - selected_match_index: usize, - matches: Vec, - history: HashMap>, -} - -impl SemanticSearchDelegate { - // This is currently searching on every keystroke, - // This is wildly overkill, and has the potential to get expensive - // We will need to update this to throttle searching - pub fn new( - workspace: WeakViewHandle, - project: ModelHandle, - vector_store: ModelHandle, - ) -> Self { - Self { - workspace, - project, - vector_store, - selected_match_index: 0, - matches: vec![], - history: HashMap::new(), - } - } -} - -impl PickerDelegate for SemanticSearchDelegate { - fn placeholder_text(&self) -> Arc { - "Search repository in natural language...".into() - } - - fn confirm(&mut self, _: bool, cx: &mut ViewContext) { - if let Some(search_result) = self.matches.get(self.selected_match_index) { - // Open Buffer - let search_result = search_result.clone(); - let buffer = self.project.update(cx, |project, cx| { - project.open_buffer( - ProjectPath { - worktree_id: search_result.worktree_id, - path: search_result.file_path.clone().into(), - }, - cx, - ) - }); - - let workspace = self.workspace.clone(); - let position = search_result.clone().offset; - cx.spawn(|_, mut cx| async move { - let buffer = buffer.await?; - workspace.update(&mut cx, |workspace, cx| { - let editor = workspace.open_project_item::(buffer, cx); - editor.update(cx, |editor, cx| { - editor.change_selections(Some(Autoscroll::center()), cx, |s| { - s.select_ranges([position..position]) - }); - }); - })?; - Ok::<_, anyhow::Error>(()) - }) - .detach_and_log_err(cx); - cx.emit(PickerEvent::Dismiss); - } - } - - fn dismissed(&mut self, _cx: &mut ViewContext) {} - - fn match_count(&self) -> usize { - self.matches.len() - } - - fn selected_index(&self) -> usize { - self.selected_match_index - } - - fn set_selected_index(&mut self, ix: usize, _cx: &mut ViewContext) { - self.selected_match_index = ix; - } - - fn update_matches(&mut self, query: String, cx: &mut ViewContext) -> Task<()> { - log::info!("Searching for {:?}...", query); - if query.len() < MIN_QUERY_LEN { - log::info!("Query below minimum length"); - return Task::ready(()); - } - - let vector_store = self.vector_store.clone(); - let project = self.project.clone(); - cx.spawn(|this, mut cx| async move { - cx.background().timer(EMBEDDING_DEBOUNCE_INTERVAL).await; - - let retrieved_cached = this.update(&mut cx, |this, _| { - let delegate = this.delegate_mut(); - if delegate.history.contains_key(&query) { - let historic_results = delegate.history.get(&query).unwrap().to_owned(); - delegate.matches = historic_results.clone(); - true - } else { - false - } - }); - - if let Some(retrieved) = retrieved_cached.log_err() { - if !retrieved { - let task = vector_store.update(&mut cx, |store, cx| { - store.search(project.clone(), query.to_string(), 10, cx) - }); - - if let Some(results) = task.await.log_err() { - log::info!("Not queried previously, searching..."); - this.update(&mut cx, |this, _| { - let delegate = this.delegate_mut(); - delegate.matches = results.clone(); - delegate.history.insert(query, results); - }) - .ok(); - } - } else { - log::info!("Already queried, retrieved directly from cached history"); - } - } - }) - } - - fn render_match( - &self, - ix: usize, - mouse_state: &mut MouseState, - selected: bool, - cx: &AppContext, - ) -> AnyElement> { - let theme = theme::current(cx); - let style = &theme.picker.item; - let current_style = style.in_state(selected).style_for(mouse_state); - - let search_result = &self.matches[ix]; - - let path = search_result.file_path.to_string_lossy(); - let name = search_result.name.clone(); - - Flex::column() - .with_child(Text::new(name, current_style.label.text.clone()).with_soft_wrap(false)) - .with_child(Label::new( - path.to_string(), - style.inactive_state().default.label.clone(), - )) - .contained() - .with_style(current_style.container) - .into_any() - } -} diff --git a/crates/vector_store/src/parsing.rs b/crates/vector_store/src/parsing.rs deleted file mode 100644 index 12e590b35f464ad960a6e779b7c56d872760657e..0000000000000000000000000000000000000000 --- a/crates/vector_store/src/parsing.rs +++ /dev/null @@ -1,115 +0,0 @@ -use std::{path::PathBuf, sync::Arc, time::SystemTime}; - -use anyhow::{anyhow, Ok, Result}; -use project::Fs; -use tree_sitter::{Parser, QueryCursor}; - -use crate::PendingFile; - -#[derive(Debug, PartialEq, Clone)] -pub struct Document { - pub offset: usize, - pub name: String, - pub embedding: Vec, -} - -#[derive(Debug, PartialEq, Clone)] -pub struct ParsedFile { - pub path: PathBuf, - pub mtime: SystemTime, - pub documents: Vec, -} - -const CODE_CONTEXT_TEMPLATE: &str = - "The below code snippet is from file ''\n\n```\n\n```"; - -pub struct CodeContextRetriever { - pub parser: Parser, - pub cursor: QueryCursor, - pub fs: Arc, -} - -impl CodeContextRetriever { - pub async fn parse_file( - &mut self, - pending_file: PendingFile, - ) -> Result<(ParsedFile, Vec)> { - let grammar = pending_file - .language - .grammar() - .ok_or_else(|| anyhow!("no grammar for language"))?; - let embedding_config = grammar - .embedding_config - .as_ref() - .ok_or_else(|| anyhow!("no embedding queries"))?; - - let content = self.fs.load(&pending_file.absolute_path).await?; - - self.parser.set_language(grammar.ts_language).unwrap(); - - let tree = self - .parser - .parse(&content, None) - .ok_or_else(|| anyhow!("parsing failed"))?; - - let mut documents = Vec::new(); - let mut context_spans = Vec::new(); - - // Iterate through query matches - for mat in self.cursor.matches( - &embedding_config.query, - tree.root_node(), - content.as_bytes(), - ) { - // log::info!("-----MATCH-----"); - - let mut name = Vec::new(); - let mut item: Option<&str> = None; - let mut offset: Option = None; - for capture in mat.captures { - if capture.index == embedding_config.item_capture_ix { - offset = Some(capture.node.byte_range().start); - item = content.get(capture.node.byte_range()); - } else if capture.index == embedding_config.name_capture_ix { - if let Some(name_content) = content.get(capture.node.byte_range()) { - name.push(name_content); - } - } - - if let Some(context_capture_ix) = embedding_config.context_capture_ix { - if capture.index == context_capture_ix { - if let Some(context) = content.get(capture.node.byte_range()) { - name.push(context); - } - } - } - } - - if item.is_some() && offset.is_some() && name.len() > 0 { - let context_span = CODE_CONTEXT_TEMPLATE - .replace("", pending_file.relative_path.to_str().unwrap()) - .replace("", &pending_file.language.name().to_lowercase()) - .replace("", item.unwrap()); - - // log::info!("Name: {:?}", name); - // log::info!("Span: {:?}", util::truncate(&context_span, 100)); - - context_spans.push(context_span); - documents.push(Document { - name: name.join(" "), - offset: offset.unwrap(), - embedding: Vec::new(), - }) - } - } - - return Ok(( - ParsedFile { - path: pending_file.relative_path, - mtime: pending_file.modified_time, - documents, - }, - context_spans, - )); - } -} diff --git a/crates/vector_store/src/vector_store.rs b/crates/vector_store/src/vector_store.rs deleted file mode 100644 index 0a197bc40663034d4156cf025c731449cef725c7..0000000000000000000000000000000000000000 --- a/crates/vector_store/src/vector_store.rs +++ /dev/null @@ -1,770 +0,0 @@ -mod db; -mod embedding; -mod modal; -mod parsing; -mod vector_store_settings; - -#[cfg(test)] -mod vector_store_tests; - -use crate::vector_store_settings::VectorStoreSettings; -use anyhow::{anyhow, Result}; -use db::VectorDatabase; -use embedding::{EmbeddingProvider, OpenAIEmbeddings}; -use futures::{channel::oneshot, Future}; -use gpui::{ - AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, Task, ViewContext, - WeakModelHandle, -}; -use language::{Language, LanguageRegistry}; -use modal::{SemanticSearch, SemanticSearchDelegate, Toggle}; -use parsing::{CodeContextRetriever, ParsedFile}; -use project::{Fs, PathChange, Project, ProjectEntryId, WorktreeId}; -use smol::channel; -use std::{ - collections::HashMap, - path::{Path, PathBuf}, - sync::Arc, - time::{Duration, Instant, SystemTime}, -}; -use tree_sitter::{Parser, QueryCursor}; -use util::{ - channel::{ReleaseChannel, RELEASE_CHANNEL, RELEASE_CHANNEL_NAME}, - http::HttpClient, - paths::EMBEDDINGS_DIR, - ResultExt, -}; -use workspace::{Workspace, WorkspaceCreated}; - -const VECTOR_STORE_VERSION: usize = 0; -const EMBEDDINGS_BATCH_SIZE: usize = 150; - -pub fn init( - fs: Arc, - http_client: Arc, - language_registry: Arc, - cx: &mut AppContext, -) { - settings::register::(cx); - - let db_file_path = EMBEDDINGS_DIR - .join(Path::new(RELEASE_CHANNEL_NAME.as_str())) - .join("embeddings_db"); - - SemanticSearch::init(cx); - cx.add_action( - |workspace: &mut Workspace, _: &Toggle, cx: &mut ViewContext| { - if cx.has_global::>() { - let vector_store = cx.global::>().clone(); - workspace.toggle_modal(cx, |workspace, cx| { - let project = workspace.project().clone(); - let workspace = cx.weak_handle(); - cx.add_view(|cx| { - SemanticSearch::new( - SemanticSearchDelegate::new(workspace, project, vector_store), - cx, - ) - }) - }); - } - }, - ); - - if *RELEASE_CHANNEL == ReleaseChannel::Stable - || !settings::get::(cx).enabled - { - return; - } - - cx.spawn(move |mut cx| async move { - let vector_store = VectorStore::new( - fs, - db_file_path, - // Arc::new(embedding::DummyEmbeddings {}), - Arc::new(OpenAIEmbeddings { - client: http_client, - executor: cx.background(), - }), - language_registry, - cx.clone(), - ) - .await?; - - cx.update(|cx| { - cx.set_global(vector_store.clone()); - cx.subscribe_global::({ - let vector_store = vector_store.clone(); - move |event, cx| { - let workspace = &event.0; - if let Some(workspace) = workspace.upgrade(cx) { - let project = workspace.read(cx).project().clone(); - if project.read(cx).is_local() { - vector_store.update(cx, |store, cx| { - store.add_project(project, cx).detach(); - }); - } - } - } - }) - .detach(); - }); - - anyhow::Ok(()) - }) - .detach(); -} - -pub struct VectorStore { - fs: Arc, - database_url: Arc, - embedding_provider: Arc, - language_registry: Arc, - db_update_tx: channel::Sender, - parsing_files_tx: channel::Sender, - _db_update_task: Task<()>, - _embed_batch_task: Task<()>, - _batch_files_task: Task<()>, - _parsing_files_tasks: Vec>, - projects: HashMap, ProjectState>, -} - -struct ProjectState { - worktree_db_ids: Vec<(WorktreeId, i64)>, - pending_files: HashMap, - _subscription: gpui::Subscription, -} - -impl ProjectState { - fn db_id_for_worktree_id(&self, id: WorktreeId) -> Option { - self.worktree_db_ids - .iter() - .find_map(|(worktree_id, db_id)| { - if *worktree_id == id { - Some(*db_id) - } else { - None - } - }) - } - - fn worktree_id_for_db_id(&self, id: i64) -> Option { - self.worktree_db_ids - .iter() - .find_map(|(worktree_id, db_id)| { - if *db_id == id { - Some(*worktree_id) - } else { - None - } - }) - } - - fn update_pending_files(&mut self, pending_file: PendingFile, indexing_time: SystemTime) { - // If Pending File Already Exists, Replace it with the new one - // but keep the old indexing time - if let Some(old_file) = self - .pending_files - .remove(&pending_file.relative_path.clone()) - { - self.pending_files.insert( - pending_file.relative_path.clone(), - (pending_file, old_file.1), - ); - } else { - self.pending_files.insert( - pending_file.relative_path.clone(), - (pending_file, indexing_time), - ); - }; - } - - fn get_outstanding_files(&mut self) -> Vec { - let mut outstanding_files = vec![]; - let mut remove_keys = vec![]; - for key in self.pending_files.keys().into_iter() { - if let Some(pending_details) = self.pending_files.get(key) { - let (pending_file, index_time) = pending_details; - if index_time <= &SystemTime::now() { - outstanding_files.push(pending_file.clone()); - remove_keys.push(key.clone()); - } - } - } - - for key in remove_keys.iter() { - self.pending_files.remove(key); - } - - return outstanding_files; - } -} - -#[derive(Clone, Debug)] -pub struct PendingFile { - worktree_db_id: i64, - relative_path: PathBuf, - absolute_path: PathBuf, - language: Arc, - modified_time: SystemTime, -} - -#[derive(Debug, Clone)] -pub struct SearchResult { - pub worktree_id: WorktreeId, - pub name: String, - pub offset: usize, - pub file_path: PathBuf, -} - -enum DbOperation { - InsertFile { - worktree_id: i64, - indexed_file: ParsedFile, - }, - Delete { - worktree_id: i64, - path: PathBuf, - }, - FindOrCreateWorktree { - path: PathBuf, - sender: oneshot::Sender>, - }, - FileMTimes { - worktree_id: i64, - sender: oneshot::Sender>>, - }, -} - -enum EmbeddingJob { - Enqueue { - worktree_id: i64, - parsed_file: ParsedFile, - document_spans: Vec, - }, - Flush, -} - -impl VectorStore { - async fn new( - fs: Arc, - database_url: PathBuf, - embedding_provider: Arc, - language_registry: Arc, - mut cx: AsyncAppContext, - ) -> Result> { - let database_url = Arc::new(database_url); - - let db = cx - .background() - .spawn({ - let fs = fs.clone(); - let database_url = database_url.clone(); - async move { - if let Some(db_directory) = database_url.parent() { - fs.create_dir(db_directory).await.log_err(); - } - - let db = VectorDatabase::new(database_url.to_string_lossy().to_string())?; - anyhow::Ok(db) - } - }) - .await?; - - Ok(cx.add_model(|cx| { - // paths_tx -> embeddings_tx -> db_update_tx - - //db_update_tx/rx: Updating Database - let (db_update_tx, db_update_rx) = channel::unbounded(); - let _db_update_task = cx.background().spawn(async move { - while let Ok(job) = db_update_rx.recv().await { - match job { - DbOperation::InsertFile { - worktree_id, - indexed_file, - } => { - db.insert_file(worktree_id, indexed_file).log_err(); - } - DbOperation::Delete { worktree_id, path } => { - db.delete_file(worktree_id, path).log_err(); - } - DbOperation::FindOrCreateWorktree { path, sender } => { - let id = db.find_or_create_worktree(&path); - sender.send(id).ok(); - } - DbOperation::FileMTimes { - worktree_id: worktree_db_id, - sender, - } => { - let file_mtimes = db.get_file_mtimes(worktree_db_id); - sender.send(file_mtimes).ok(); - } - } - } - }); - - // embed_tx/rx: Embed Batch and Send to Database - let (embed_batch_tx, embed_batch_rx) = - channel::unbounded::)>>(); - let _embed_batch_task = cx.background().spawn({ - let db_update_tx = db_update_tx.clone(); - let embedding_provider = embedding_provider.clone(); - async move { - while let Ok(mut embeddings_queue) = embed_batch_rx.recv().await { - // Construct Batch - let mut document_spans = vec![]; - for (_, _, document_span) in embeddings_queue.iter() { - document_spans.extend(document_span.iter().map(|s| s.as_str())); - } - - if let Ok(embeddings) = embedding_provider.embed_batch(document_spans).await - { - let mut i = 0; - let mut j = 0; - - for embedding in embeddings.iter() { - while embeddings_queue[i].1.documents.len() == j { - i += 1; - j = 0; - } - - embeddings_queue[i].1.documents[j].embedding = embedding.to_owned(); - j += 1; - } - - for (worktree_id, indexed_file, _) in embeddings_queue.into_iter() { - for document in indexed_file.documents.iter() { - // TODO: Update this so it doesn't panic - assert!( - document.embedding.len() > 0, - "Document Embedding Not Complete" - ); - } - - db_update_tx - .send(DbOperation::InsertFile { - worktree_id, - indexed_file, - }) - .await - .unwrap(); - } - } - } - } - }); - - // batch_tx/rx: Batch Files to Send for Embeddings - let (batch_files_tx, batch_files_rx) = channel::unbounded::(); - let _batch_files_task = cx.background().spawn(async move { - let mut queue_len = 0; - let mut embeddings_queue = vec![]; - - while let Ok(job) = batch_files_rx.recv().await { - let should_flush = match job { - EmbeddingJob::Enqueue { - document_spans, - worktree_id, - parsed_file, - } => { - queue_len += &document_spans.len(); - embeddings_queue.push((worktree_id, parsed_file, document_spans)); - queue_len >= EMBEDDINGS_BATCH_SIZE - } - EmbeddingJob::Flush => true, - }; - - if should_flush { - embed_batch_tx.try_send(embeddings_queue).unwrap(); - embeddings_queue = vec![]; - queue_len = 0; - } - } - }); - - // parsing_files_tx/rx: Parsing Files to Embeddable Documents - let (parsing_files_tx, parsing_files_rx) = channel::unbounded::(); - - let mut _parsing_files_tasks = Vec::new(); - // for _ in 0..cx.background().num_cpus() { - for _ in 0..1 { - let fs = fs.clone(); - let parsing_files_rx = parsing_files_rx.clone(); - let batch_files_tx = batch_files_tx.clone(); - _parsing_files_tasks.push(cx.background().spawn(async move { - let parser = Parser::new(); - let cursor = QueryCursor::new(); - let mut retriever = CodeContextRetriever { parser, cursor, fs }; - while let Ok(pending_file) = parsing_files_rx.recv().await { - if let Some((indexed_file, document_spans)) = - retriever.parse_file(pending_file.clone()).await.log_err() - { - batch_files_tx - .try_send(EmbeddingJob::Enqueue { - worktree_id: pending_file.worktree_db_id, - parsed_file: indexed_file, - document_spans, - }) - .unwrap(); - } - - if parsing_files_rx.len() == 0 { - batch_files_tx.try_send(EmbeddingJob::Flush).unwrap(); - } - } - })); - } - - Self { - fs, - database_url, - embedding_provider, - language_registry, - db_update_tx, - parsing_files_tx, - _db_update_task, - _embed_batch_task, - _batch_files_task, - _parsing_files_tasks, - projects: HashMap::new(), - } - })) - } - - fn find_or_create_worktree(&self, path: PathBuf) -> impl Future> { - let (tx, rx) = oneshot::channel(); - self.db_update_tx - .try_send(DbOperation::FindOrCreateWorktree { path, sender: tx }) - .unwrap(); - async move { rx.await? } - } - - fn get_file_mtimes( - &self, - worktree_id: i64, - ) -> impl Future>> { - let (tx, rx) = oneshot::channel(); - self.db_update_tx - .try_send(DbOperation::FileMTimes { - worktree_id, - sender: tx, - }) - .unwrap(); - async move { rx.await? } - } - - fn add_project( - &mut self, - project: ModelHandle, - cx: &mut ModelContext, - ) -> Task> { - let worktree_scans_complete = project - .read(cx) - .worktrees(cx) - .map(|worktree| { - let scan_complete = worktree.read(cx).as_local().unwrap().scan_complete(); - async move { - scan_complete.await; - } - }) - .collect::>(); - let worktree_db_ids = project - .read(cx) - .worktrees(cx) - .map(|worktree| { - self.find_or_create_worktree(worktree.read(cx).abs_path().to_path_buf()) - }) - .collect::>(); - - let fs = self.fs.clone(); - let language_registry = self.language_registry.clone(); - let database_url = self.database_url.clone(); - let db_update_tx = self.db_update_tx.clone(); - let parsing_files_tx = self.parsing_files_tx.clone(); - - cx.spawn(|this, mut cx| async move { - futures::future::join_all(worktree_scans_complete).await; - - let worktree_db_ids = futures::future::join_all(worktree_db_ids).await; - - if let Some(db_directory) = database_url.parent() { - fs.create_dir(db_directory).await.log_err(); - } - - let worktrees = project.read_with(&cx, |project, cx| { - project - .worktrees(cx) - .map(|worktree| worktree.read(cx).snapshot()) - .collect::>() - }); - - let mut worktree_file_times = HashMap::new(); - let mut db_ids_by_worktree_id = HashMap::new(); - for (worktree, db_id) in worktrees.iter().zip(worktree_db_ids) { - let db_id = db_id?; - db_ids_by_worktree_id.insert(worktree.id(), db_id); - worktree_file_times.insert( - worktree.id(), - this.read_with(&cx, |this, _| this.get_file_mtimes(db_id)) - .await?, - ); - } - - cx.background() - .spawn({ - let db_ids_by_worktree_id = db_ids_by_worktree_id.clone(); - let db_update_tx = db_update_tx.clone(); - let language_registry = language_registry.clone(); - let parsing_files_tx = parsing_files_tx.clone(); - async move { - let t0 = Instant::now(); - for worktree in worktrees.into_iter() { - let mut file_mtimes = - worktree_file_times.remove(&worktree.id()).unwrap(); - for file in worktree.files(false, 0) { - let absolute_path = worktree.absolutize(&file.path); - - if let Ok(language) = language_registry - .language_for_file(&absolute_path, None) - .await - { - if language - .grammar() - .and_then(|grammar| grammar.embedding_config.as_ref()) - .is_none() - { - continue; - } - - let path_buf = file.path.to_path_buf(); - let stored_mtime = file_mtimes.remove(&file.path.to_path_buf()); - let already_stored = stored_mtime - .map_or(false, |existing_mtime| { - existing_mtime == file.mtime - }); - - if !already_stored { - parsing_files_tx - .try_send(PendingFile { - worktree_db_id: db_ids_by_worktree_id - [&worktree.id()], - relative_path: path_buf, - absolute_path, - language, - modified_time: file.mtime, - }) - .unwrap(); - } - } - } - for file in file_mtimes.keys() { - db_update_tx - .try_send(DbOperation::Delete { - worktree_id: db_ids_by_worktree_id[&worktree.id()], - path: file.to_owned(), - }) - .unwrap(); - } - } - log::info!( - "Parsing Worktree Completed in {:?}", - t0.elapsed().as_millis() - ); - } - }) - .detach(); - - // let mut pending_files: Vec<(PathBuf, ((i64, PathBuf, Arc, SystemTime), SystemTime))> = vec![]; - this.update(&mut cx, |this, cx| { - // The below is managing for updated on save - // Currently each time a file is saved, this code is run, and for all the files that were changed, if the current time is - // greater than the previous embedded time by the REINDEXING_DELAY variable, we will send the file off to be indexed. - let _subscription = cx.subscribe(&project, |this, project, event, cx| { - if let project::Event::WorktreeUpdatedEntries(worktree_id, changes) = event { - this.project_entries_changed(project, changes.clone(), cx, worktree_id); - } - }); - - this.projects.insert( - project.downgrade(), - ProjectState { - pending_files: HashMap::new(), - worktree_db_ids: db_ids_by_worktree_id.into_iter().collect(), - _subscription, - }, - ); - }); - - anyhow::Ok(()) - }) - } - - pub fn search( - &mut self, - project: ModelHandle, - phrase: String, - limit: usize, - cx: &mut ModelContext, - ) -> Task>> { - let project_state = if let Some(state) = self.projects.get(&project.downgrade()) { - state - } else { - return Task::ready(Err(anyhow!("project not added"))); - }; - - let worktree_db_ids = project - .read(cx) - .worktrees(cx) - .filter_map(|worktree| { - let worktree_id = worktree.read(cx).id(); - project_state.db_id_for_worktree_id(worktree_id) - }) - .collect::>(); - - let embedding_provider = self.embedding_provider.clone(); - let database_url = self.database_url.clone(); - cx.spawn(|this, cx| async move { - let documents = cx - .background() - .spawn(async move { - let database = VectorDatabase::new(database_url.to_string_lossy().into())?; - - let phrase_embedding = embedding_provider - .embed_batch(vec![&phrase]) - .await? - .into_iter() - .next() - .unwrap(); - - database.top_k_search(&worktree_db_ids, &phrase_embedding, limit) - }) - .await?; - - this.read_with(&cx, |this, _| { - let project_state = if let Some(state) = this.projects.get(&project.downgrade()) { - state - } else { - return Err(anyhow!("project not added")); - }; - - Ok(documents - .into_iter() - .filter_map(|(worktree_db_id, file_path, offset, name)| { - let worktree_id = project_state.worktree_id_for_db_id(worktree_db_id)?; - Some(SearchResult { - worktree_id, - name, - offset, - file_path, - }) - }) - .collect()) - }) - }) - } - - fn project_entries_changed( - &mut self, - project: ModelHandle, - changes: Arc<[(Arc, ProjectEntryId, PathChange)]>, - cx: &mut ModelContext<'_, VectorStore>, - worktree_id: &WorktreeId, - ) -> Option<()> { - let reindexing_delay = settings::get::(cx).reindexing_delay_seconds; - - let worktree = project - .read(cx) - .worktree_for_id(worktree_id.clone(), cx)? - .read(cx) - .snapshot(); - - let worktree_db_id = self - .projects - .get(&project.downgrade())? - .db_id_for_worktree_id(worktree.id())?; - let file_mtimes = self.get_file_mtimes(worktree_db_id); - - let language_registry = self.language_registry.clone(); - - cx.spawn(|this, mut cx| async move { - let file_mtimes = file_mtimes.await.log_err()?; - - for change in changes.into_iter() { - let change_path = change.0.clone(); - let absolute_path = worktree.absolutize(&change_path); - - // Skip if git ignored or symlink - if let Some(entry) = worktree.entry_for_id(change.1) { - if entry.is_ignored || entry.is_symlink || entry.is_external { - continue; - } - } - - match change.2 { - PathChange::Removed => this.update(&mut cx, |this, _| { - this.db_update_tx - .try_send(DbOperation::Delete { - worktree_id: worktree_db_id, - path: absolute_path, - }) - .unwrap(); - }), - _ => { - if let Ok(language) = language_registry - .language_for_file(&change_path.to_path_buf(), None) - .await - { - if language - .grammar() - .and_then(|grammar| grammar.embedding_config.as_ref()) - .is_none() - { - continue; - } - - let modified_time = - change_path.metadata().log_err()?.modified().log_err()?; - - let existing_time = file_mtimes.get(&change_path.to_path_buf()); - let already_stored = existing_time - .map_or(false, |existing_time| &modified_time != existing_time); - - if !already_stored { - this.update(&mut cx, |this, _| { - let reindex_time = modified_time - + Duration::from_secs(reindexing_delay as u64); - - let project_state = - this.projects.get_mut(&project.downgrade())?; - project_state.update_pending_files( - PendingFile { - relative_path: change_path.to_path_buf(), - absolute_path, - modified_time, - worktree_db_id, - language: language.clone(), - }, - reindex_time, - ); - - for file in project_state.get_outstanding_files() { - this.parsing_files_tx.try_send(file).unwrap(); - } - Some(()) - }); - } - } - } - } - } - - Some(()) - }) - .detach(); - - Some(()) - } -} - -impl Entity for VectorStore { - type Event = (); -} diff --git a/crates/vector_store/src/vector_store_tests.rs b/crates/vector_store/src/vector_store_tests.rs deleted file mode 100644 index b6e47e7a2341e71a790a749642770e81cd147aaf..0000000000000000000000000000000000000000 --- a/crates/vector_store/src/vector_store_tests.rs +++ /dev/null @@ -1,161 +0,0 @@ -use crate::{ - db::dot, embedding::EmbeddingProvider, vector_store_settings::VectorStoreSettings, VectorStore, -}; -use anyhow::Result; -use async_trait::async_trait; -use gpui::{Task, TestAppContext}; -use language::{Language, LanguageConfig, LanguageRegistry}; -use project::{project_settings::ProjectSettings, FakeFs, Project}; -use rand::{rngs::StdRng, Rng}; -use serde_json::json; -use settings::SettingsStore; -use std::sync::Arc; -use unindent::Unindent; - -#[gpui::test] -async fn test_vector_store(cx: &mut TestAppContext) { - cx.update(|cx| { - cx.set_global(SettingsStore::test(cx)); - settings::register::(cx); - settings::register::(cx); - }); - - let fs = FakeFs::new(cx.background()); - fs.insert_tree( - "/the-root", - json!({ - "src": { - "file1.rs": " - fn aaa() { - println!(\"aaaa!\"); - } - - fn zzzzzzzzz() { - println!(\"SLEEPING\"); - } - ".unindent(), - "file2.rs": " - fn bbb() { - println!(\"bbbb!\"); - } - ".unindent(), - } - }), - ) - .await; - - let languages = Arc::new(LanguageRegistry::new(Task::ready(()))); - let rust_language = Arc::new( - Language::new( - LanguageConfig { - name: "Rust".into(), - path_suffixes: vec!["rs".into()], - ..Default::default() - }, - Some(tree_sitter_rust::language()), - ) - .with_embedding_query( - r#" - (function_item - name: (identifier) @name - body: (block)) @item - "#, - ) - .unwrap(), - ); - languages.add(rust_language); - - let db_dir = tempdir::TempDir::new("vector-store").unwrap(); - let db_path = db_dir.path().join("db.sqlite"); - - let store = VectorStore::new( - fs.clone(), - db_path, - Arc::new(FakeEmbeddingProvider), - languages, - cx.to_async(), - ) - .await - .unwrap(); - - let project = Project::test(fs, ["/the-root".as_ref()], cx).await; - let worktree_id = project.read_with(cx, |project, cx| { - project.worktrees(cx).next().unwrap().read(cx).id() - }); - store - .update(cx, |store, cx| store.add_project(project.clone(), cx)) - .await - .unwrap(); - cx.foreground().run_until_parked(); - - let search_results = store - .update(cx, |store, cx| { - store.search(project.clone(), "aaaa".to_string(), 5, cx) - }) - .await - .unwrap(); - - assert_eq!(search_results[0].offset, 0); - assert_eq!(search_results[0].name, "aaa"); - assert_eq!(search_results[0].worktree_id, worktree_id); -} - -#[gpui::test] -fn test_dot_product(mut rng: StdRng) { - assert_eq!(dot(&[1., 0., 0., 0., 0.], &[0., 1., 0., 0., 0.]), 0.); - assert_eq!(dot(&[2., 0., 0., 0., 0.], &[3., 1., 0., 0., 0.]), 6.); - - for _ in 0..100 { - let size = 1536; - let mut a = vec![0.; size]; - let mut b = vec![0.; size]; - for (a, b) in a.iter_mut().zip(b.iter_mut()) { - *a = rng.gen(); - *b = rng.gen(); - } - - assert_eq!( - round_to_decimals(dot(&a, &b), 1), - round_to_decimals(reference_dot(&a, &b), 1) - ); - } - - fn round_to_decimals(n: f32, decimal_places: i32) -> f32 { - let factor = (10.0 as f32).powi(decimal_places); - (n * factor).round() / factor - } - - fn reference_dot(a: &[f32], b: &[f32]) -> f32 { - a.iter().zip(b.iter()).map(|(a, b)| a * b).sum() - } -} - -struct FakeEmbeddingProvider; - -#[async_trait] -impl EmbeddingProvider for FakeEmbeddingProvider { - async fn embed_batch(&self, spans: Vec<&str>) -> Result>> { - Ok(spans - .iter() - .map(|span| { - let mut result = vec![1.0; 26]; - for letter in span.chars() { - let letter = letter.to_ascii_lowercase(); - if letter as u32 >= 'a' as u32 { - let ix = (letter as u32) - ('a' as u32); - if ix < 26 { - result[ix as usize] += 1.0; - } - } - } - - let norm = result.iter().map(|x| x * x).sum::().sqrt(); - for x in &mut result { - *x /= norm; - } - - result - }) - .collect()) - } -} diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 9bd2de0accc99f9c023779a3a99657cd31df71c1..8c423eb51b8f1a3f85d6c5dc41d138a776a8229d 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -64,7 +64,7 @@ terminal_view = { path = "../terminal_view" } theme = { path = "../theme" } theme_selector = { path = "../theme_selector" } util = { path = "../util" } -vector_store = { path = "../vector_store" } +semantic_index = { path = "../semantic_index" } vim = { path = "../vim" } workspace = { path = "../workspace" } welcome = { path = "../welcome" } diff --git a/crates/zed/src/languages/c/embedding.scm b/crates/zed/src/languages/c/embedding.scm new file mode 100644 index 0000000000000000000000000000000000000000..0178abeb18374771967c09c93b9fcfc504e1e556 --- /dev/null +++ b/crates/zed/src/languages/c/embedding.scm @@ -0,0 +1,43 @@ +( + (comment)* @context + . + (declaration + declarator: [ + (function_declarator + declarator: (_) @name) + (pointer_declarator + "*" @name + declarator: (function_declarator + declarator: (_) @name)) + (pointer_declarator + "*" @name + declarator: (pointer_declarator + "*" @name + declarator: (function_declarator + declarator: (_) @name))) + ] + ) @item + ) + +( + (comment)* @context + . + (function_definition + declarator: [ + (function_declarator + declarator: (_) @name + ) + (pointer_declarator + "*" @name + declarator: (function_declarator + declarator: (_) @name + )) + (pointer_declarator + "*" @name + declarator: (pointer_declarator + "*" @name + declarator: (function_declarator + declarator: (_) @name))) + ] + ) @item + ) diff --git a/crates/zed/src/languages/cpp/embedding.scm b/crates/zed/src/languages/cpp/embedding.scm new file mode 100644 index 0000000000000000000000000000000000000000..bbd93f20dbdf6eddd097f49b7603ec5e0dc9bc59 --- /dev/null +++ b/crates/zed/src/languages/cpp/embedding.scm @@ -0,0 +1,61 @@ +( + (comment)* @context + . + (function_definition + (type_qualifier)? @name + type: (_)? @name + declarator: [ + (function_declarator + declarator: (_) @name) + (pointer_declarator + "*" @name + declarator: (function_declarator + declarator: (_) @name)) + (pointer_declarator + "*" @name + declarator: (pointer_declarator + "*" @name + declarator: (function_declarator + declarator: (_) @name))) + (reference_declarator + ["&" "&&"] @name + (function_declarator + declarator: (_) @name)) + ] + (type_qualifier)? @name) @item + ) + +( + (comment)* @context + . + (template_declaration + (class_specifier + "class" @name + name: (_) @name) + ) @item +) + +( + (comment)* @context + . + (class_specifier + "class" @name + name: (_) @name) @item + ) + +( + (comment)* @context + . + (enum_specifier + "enum" @name + name: (_) @name) @item + ) + +( + (comment)* @context + . + (declaration + type: (struct_specifier + "struct" @name) + declarator: (_) @name) @item +) diff --git a/crates/zed/src/languages/elixir/embedding.scm b/crates/zed/src/languages/elixir/embedding.scm new file mode 100644 index 0000000000000000000000000000000000000000..16ad20746d4b0c8697ff126fcc5150636cb8b794 --- /dev/null +++ b/crates/zed/src/languages/elixir/embedding.scm @@ -0,0 +1,27 @@ +( + (unary_operator + operator: "@" + operand: (call + target: (identifier) @unary + (#match? @unary "^(doc)$")) + ) @context + . + (call + target: (identifier) @name + (arguments + [ + (identifier) @name + (call + target: (identifier) @name) + (binary_operator + left: (call + target: (identifier) @name) + operator: "when") + ]) + (#match? @name "^(def|defp|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp)$")) @item + ) + + (call + target: (identifier) @name + (arguments (alias) @name) + (#match? @name "^(defmodule|defprotocol)$")) @item diff --git a/crates/zed/src/languages/go/embedding.scm b/crates/zed/src/languages/go/embedding.scm new file mode 100644 index 0000000000000000000000000000000000000000..9d8700cdfb57d1008acc09c11013f2046e7bd157 --- /dev/null +++ b/crates/zed/src/languages/go/embedding.scm @@ -0,0 +1,24 @@ +( + (comment)* @context + . + (type_declaration + (type_spec + name: (_) @name) + ) @item +) + +( + (comment)* @context + . + (function_declaration + name: (_) @name + ) @item +) + +( + (comment)* @context + . + (method_declaration + name: (_) @name + ) @item +) diff --git a/crates/zed/src/languages/javascript/embedding.scm b/crates/zed/src/languages/javascript/embedding.scm index ec6eb5ab1a8be481bc7a9987056ce2d1cb7d2474..ab1a3b6b063c3bf57adad3c302a156fcd0239448 100644 --- a/crates/zed/src/languages/javascript/embedding.scm +++ b/crates/zed/src/languages/javascript/embedding.scm @@ -1,56 +1,71 @@ -; (internal_module -; "namespace" @context -; name: (_) @name) @item - -(enum_declaration - "enum" @context - name: (_) @name) @item - -(function_declaration - "async"? @context - "function" @context - name: (_) @name) @item - -(interface_declaration - "interface" @context - name: (_) @name) @item - -; (program -; (export_statement -; (lexical_declaration -; ["let" "const"] @context -; (variable_declarator -; name: (_) @name) @item))) +( + (comment)* @context + . + [ + (export_statement + (function_declaration + "async"? @name + "function" @name + name: (_) @name)) + (function_declaration + "async"? @name + "function" @name + name: (_) @name) + ] @item +) -(program - (lexical_declaration - ["let" "const"] @context - (variable_declarator - name: (_) @name) @item)) +( + (comment)* @context + . + [ + (export_statement + (class_declaration + "class" @name + name: (_) @name)) + (class_declaration + "class" @name + name: (_) @name) + ] @item +) -(class_declaration - "class" @context - name: (_) @name) @item +( + (comment)* @context + . + [ + (export_statement + (interface_declaration + "interface" @name + name: (_) @name)) + (interface_declaration + "interface" @name + name: (_) @name) + ] @item +) -(method_definition +( + (comment)* @context + . [ - "get" - "set" - "async" - "*" - "readonly" - "static" - (override_modifier) - (accessibility_modifier) - ]* @context - name: (_) @name) @item + (export_statement + (enum_declaration + "enum" @name + name: (_) @name)) + (enum_declaration + "enum" @name + name: (_) @name) + ] @item +) -; (public_field_definition -; [ -; "declare" -; "readonly" -; "abstract" -; "static" -; (accessibility_modifier) -; ]* @context -; name: (_) @name) @item +( + (comment)* @context + . + (method_definition + [ + "get" + "set" + "async" + "*" + "static" + ]* @name + name: (_) @name) @item +) diff --git a/crates/zed/src/languages/json/embedding.scm b/crates/zed/src/languages/json/embedding.scm new file mode 100644 index 0000000000000000000000000000000000000000..fa286e3880aa67d49f710f991d6839ebbd306104 --- /dev/null +++ b/crates/zed/src/languages/json/embedding.scm @@ -0,0 +1,14 @@ +; Only produce one embedding for the entire file. +(document) @item + +; Collapse arrays, except for the first object. +(array + "[" @keep + . + (object)? @keep + "]" @keep) @collapse + +; Collapse string values (but not keys). +(pair value: (string + "\"" @keep + "\"" @keep) @collapse) diff --git a/crates/zed/src/languages/rust/config.toml b/crates/zed/src/languages/rust/config.toml index 705287f0a758045ce8179bfc8a6bf18e564970b8..8216ba0a74a90a16f2e29be77021f56530649c52 100644 --- a/crates/zed/src/languages/rust/config.toml +++ b/crates/zed/src/languages/rust/config.toml @@ -10,3 +10,4 @@ brackets = [ { start = "\"", end = "\"", close = true, newline = false, not_in = ["string"] }, { start = "/*", end = " */", close = true, newline = false, not_in = ["string", "comment"] }, ] +collapsed_placeholder = " /* ... */ " diff --git a/crates/zed/src/languages/rust/embedding.scm b/crates/zed/src/languages/rust/embedding.scm index ea8bab9f68113a9b725e094a4d31f3e572c4bed7..e4218382a9b1ceb7e087b0d9247d5a4e66b77236 100644 --- a/crates/zed/src/languages/rust/embedding.scm +++ b/crates/zed/src/languages/rust/embedding.scm @@ -1,36 +1,28 @@ -(struct_item - (visibility_modifier)? @context - "struct" @context - name: (_) @name) @item +( + [(line_comment) (attribute_item)]* @context + . + [ + (struct_item + name: (_) @name) -(enum_item - (visibility_modifier)? @context - "enum" @context - name: (_) @name) @item + (enum_item + name: (_) @name) -(impl_item - "impl" @context - trait: (_)? @name - "for"? @context - type: (_) @name) @item + (impl_item + trait: (_)? @name + "for"? @name + type: (_) @name) -(trait_item - (visibility_modifier)? @context - "trait" @context - name: (_) @name) @item + (trait_item + name: (_) @name) -(function_item - (visibility_modifier)? @context - (function_modifiers)? @context - "fn" @context - name: (_) @name) @item + (function_item + name: (_) @name + body: (block + "{" @keep + "}" @keep) @collapse) -(function_signature_item - (visibility_modifier)? @context - (function_modifiers)? @context - "fn" @context - name: (_) @name) @item - -(macro_definition - . "macro_rules!" @context - name: (_) @name) @item + (macro_definition + name: (_) @name) + ] @item + ) diff --git a/crates/zed/src/languages/tsx/embedding.scm b/crates/zed/src/languages/tsx/embedding.scm index 305f634e04ba245115907c1f113fe0c64cab1143..ddcff665841091aa170bd5f9bb60439a2cadb2c5 100644 --- a/crates/zed/src/languages/tsx/embedding.scm +++ b/crates/zed/src/languages/tsx/embedding.scm @@ -1,35 +1,85 @@ -(enum_declaration - "enum" @context - name: (_) @name) @item - -(function_declaration - "async"? @context - "function" @context - name: (_) @name) @item +( + (comment)* @context + . + [ + (export_statement + (function_declaration + "async"? @name + "function" @name + name: (_) @name)) + (function_declaration + "async"? @name + "function" @name + name: (_) @name) + ] @item + ) -(interface_declaration - "interface" @context - name: (_) @name) @item +( + (comment)* @context + . + [ + (export_statement + (class_declaration + "class" @name + name: (_) @name)) + (class_declaration + "class" @name + name: (_) @name) + ] @item + ) -(program - (lexical_declaration - ["let" "const"] @context - (variable_declarator - name: (_) @name) @item)) +( + (comment)* @context + . + [ + (export_statement + (interface_declaration + "interface" @name + name: (_) @name)) + (interface_declaration + "interface" @name + name: (_) @name) + ] @item + ) -(class_declaration - "class" @context - name: (_) @name) @item +( + (comment)* @context + . + [ + (export_statement + (enum_declaration + "enum" @name + name: (_) @name)) + (enum_declaration + "enum" @name + name: (_) @name) + ] @item + ) -(method_definition +( + (comment)* @context + . [ - "get" - "set" - "async" - "*" - "readonly" - "static" - (override_modifier) - (accessibility_modifier) - ]* @context - name: (_) @name) @item + (export_statement + (type_alias_declaration + "type" @name + name: (_) @name)) + (type_alias_declaration + "type" @name + name: (_) @name) + ] @item + ) + +( + (comment)* @context + . + (method_definition + [ + "get" + "set" + "async" + "*" + "static" + ]* @name + name: (_) @name) @item + ) diff --git a/crates/zed/src/languages/typescript/embedding.scm b/crates/zed/src/languages/typescript/embedding.scm index f261a0a56577176108dc1ef2b5cf6de3569a0531..3170cb7c957e51e00c175c7eaa2b4b51deda042a 100644 --- a/crates/zed/src/languages/typescript/embedding.scm +++ b/crates/zed/src/languages/typescript/embedding.scm @@ -1,59 +1,85 @@ -; (internal_module -; "namespace" @context -; name: (_) @name) @item - -(enum_declaration - "enum" @context - name: (_) @name) @item - -; (type_alias_declaration -; "type" @context -; name: (_) @name) @item - -(function_declaration - "async"? @context - "function" @context - name: (_) @name) @item - -(interface_declaration - "interface" @context - name: (_) @name) @item +( + (comment)* @context + . + [ + (export_statement + (function_declaration + "async"? @name + "function" @name + name: (_) @name)) + (function_declaration + "async"? @name + "function" @name + name: (_) @name) + ] @item +) -; (export_statement -; (lexical_declaration -; ["let" "const"] @context -; (variable_declarator -; name: (_) @name) @item)) +( + (comment)* @context + . + [ + (export_statement + (class_declaration + "class" @name + name: (_) @name)) + (class_declaration + "class" @name + name: (_) @name) + ] @item +) -(program - (lexical_declaration - ["let" "const"] @context - (variable_declarator - name: (_) @name) @item)) +( + (comment)* @context + . + [ + (export_statement + (interface_declaration + "interface" @name + name: (_) @name)) + (interface_declaration + "interface" @name + name: (_) @name) + ] @item +) -(class_declaration - "class" @context - name: (_) @name) @item +( + (comment)* @context + . + [ + (export_statement + (enum_declaration + "enum" @name + name: (_) @name)) + (enum_declaration + "enum" @name + name: (_) @name) + ] @item +) -(method_definition +( + (comment)* @context + . [ - "get" - "set" - "async" - "*" - "readonly" - "static" - (override_modifier) - (accessibility_modifier) - ]* @context - name: (_) @name) @item + (export_statement + (type_alias_declaration + "type" @name + name: (_) @name)) + (type_alias_declaration + "type" @name + name: (_) @name) + ] @item +) -; (public_field_definition -; [ -; "declare" -; "readonly" -; "abstract" -; "static" -; (accessibility_modifier) -; ]* @context -; name: (_) @name) @item +( + (comment)* @context + . + (method_definition + [ + "get" + "set" + "async" + "*" + "static" + ]* @name + name: (_) @name) @item +) diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 3f89ab3f1f2a690f3d1087522821b4aad35a72d7..df16ea7db97fbbd2acfb005be15ff45af7ef4ad1 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -157,7 +157,7 @@ fn main() { project_panel::init(Assets, cx); diagnostics::init(cx); search::init(cx); - vector_store::init(fs.clone(), http.clone(), languages.clone(), cx); + semantic_index::init(fs.clone(), http.clone(), languages.clone(), cx); vim::init(cx); terminal_view::init(cx); copilot::init(http.clone(), node_runtime, cx);