diff --git a/.gitignore b/.gitignore index 2da1549c..0ff7be51 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ target/ # File system .DS_Store desktop.ini + +*.log \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 94983da5..c1b9bd66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,16 +3,25 @@ version = 3 [[package]] -name = "adler" -version = "1.0.2" +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "getrandom", @@ -23,24 +32,24 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "async-channel" @@ -60,22 +69,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" dependencies = [ "concurrent-queue", - "event-listener-strategy 0.5.2", + "event-listener-strategy", "futures-core", "pin-project-lite", ] [[package]] name = "async-executor" -version = "1.8.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ - "async-lock 3.3.0", "async-task", "concurrent-queue", - "fastrand 2.0.1", - "futures-lite 2.2.0", + "fastrand 2.2.0", + "futures-lite 2.5.0", "slab", ] @@ -87,10 +95,10 @@ checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel 2.3.1", "async-executor", - "async-io 2.3.1", - "async-lock 3.3.0", + "async-io 2.4.0", + "async-lock 3.4.0", "blocking", - "futures-lite 2.2.0", + "futures-lite 2.5.0", "once_cell", ] @@ -116,21 +124,21 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65" +checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" dependencies = [ - "async-lock 3.3.0", + "async-lock 3.4.0", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.2.0", + "futures-lite 2.5.0", "parking", - "polling 3.4.0", - "rustix 0.38.31", + "polling 3.7.4", + "rustix 0.38.41", "slab", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -144,30 +152,30 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener 4.0.3", - "event-listener-strategy 0.4.0", + "event-listener 5.3.1", + "event-listener-strategy", "pin-project-lite", ] [[package]] name = "async-std" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +checksum = "c634475f29802fde2b8f0b505b1bd00dfe4df7d4a000f0b36f7671197d5c3615" dependencies = [ "async-channel 1.9.0", "async-global-executor", - "async-io 1.13.0", - "async-lock 2.8.0", + "async-io 2.4.0", + "async-lock 3.4.0", "crossbeam-utils", "futures-channel", "futures-core", "futures-io", - "futures-lite 1.13.0", + "futures-lite 2.5.0", "gloo-timers", "kv-log-macro", "log", @@ -181,9 +189,20 @@ dependencies = [ [[package]] name = "async-task" -version = "4.7.0" +version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] [[package]] name = "atoi" @@ -201,20 +220,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] -name = "atomic-write-file" -version = "0.1.2" +name = "auto_impl" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edcdbedc2236483ab103a53415653d6b4442ea6141baf1ffa85df29635e88436" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ - "nix", - "rand", + "proc-macro2", + "quote", + "syn 2.0.89", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] [[package]] name = "base64" @@ -234,7 +269,7 @@ version = "0.66.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "cexpr", "clang-sys", "lazy_static", @@ -247,7 +282,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.71", + "syn 2.0.89", "which", ] @@ -259,9 +294,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" dependencies = [ "serde", ] @@ -277,25 +312,22 @@ dependencies = [ [[package]] name = "blocking" -version = "1.5.1" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" dependencies = [ "async-channel 2.3.1", - "async-lock 3.3.0", "async-task", - "fastrand 2.0.1", "futures-io", - "futures-lite 2.2.0", + "futures-lite 2.5.0", "piper", - "tracing", ] [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" @@ -305,17 +337,17 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "cc" -version = "1.0.83" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ - "libc", + "shlex", ] [[package]] @@ -335,9 +367,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clang-sys" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", @@ -346,9 +378,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.50" +version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" dependencies = [ "cc", ] @@ -391,18 +423,18 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] [[package]] name = "crc" -version = "3.0.1" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" dependencies = [ "crc-catalog", ] @@ -415,18 +447,18 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ "crossbeam-utils", ] @@ -442,9 +474,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crypto-common" @@ -458,13 +490,13 @@ dependencies = [ [[package]] name = "cstree" -version = "0.12.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b0cb07675f2025784ff3964c5b8fdcf0cc86c1288ae2d798549b7866b66d96" +checksum = "8d609e3b8b73dbace666e8a06351fd9062e1ec025e74b27952a932ccb8ec3a25" dependencies = [ "cstree_derive", "fxhash", - "indexmap 1.9.3", + "indexmap", "parking_lot", "sptr", "text-size", @@ -473,13 +505,13 @@ dependencies = [ [[package]] name = "cstree_derive" -version = "0.12.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da6c38bede0ecec78757fe92451c463ac9e6d37961c2cbce6a20be917951baf" +checksum = "84d8f6eaf2917e8bf0173045fe7824c0809e21ef09dc721108da4ee67ce7494b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.89", ] [[package]] @@ -489,7 +521,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -497,9 +529,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "pem-rfc7468", @@ -548,6 +580,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + [[package]] name = "dotenvy" version = "0.15.7" @@ -556,9 +599,9 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "either" -version = "1.10.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" dependencies = [ "serde", ] @@ -577,9 +620,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -604,43 +647,22 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener" -version = "5.0.0" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72557800024fabbaa2449dd4bf24e37b93702d457a4d4f2b0dd1f0f039f20c1" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" dependencies = [ "concurrent-queue", "parking", "pin-project-lite", ] -[[package]] -name = "event-listener-strategy" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" -dependencies = [ - "event-listener 4.0.3", - "pin-project-lite", -] - [[package]] name = "event-listener-strategy" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" dependencies = [ - "event-listener 5.0.0", + "event-listener 5.3.1", "pin-project-lite", ] @@ -655,15 +677,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - -[[package]] -name = "finl_unicode" -version = "1.2.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "fixedbitset" @@ -673,9 +689,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -683,13 +699,13 @@ dependencies = [ [[package]] name = "flume" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" dependencies = [ "futures-core", "futures-sink", - "spin 0.9.8", + "spin", ] [[package]] @@ -707,11 +723,25 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -719,15 +749,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -747,9 +777,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" @@ -768,37 +798,50 @@ dependencies = [ [[package]] name = "futures-lite" -version = "2.2.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" +checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" dependencies = [ - "fastrand 2.0.1", + "fastrand 2.2.0", "futures-core", "futures-io", "parking", "pin-project-lite", ] +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ + "futures-channel", "futures-core", "futures-io", + "futures-macro", "futures-sink", "futures-task", "memchr", @@ -828,15 +871,21 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", "wasi", ] +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + [[package]] name = "glob" version = "0.3.1" @@ -845,9 +894,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "gloo-timers" -version = "0.2.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" dependencies = [ "futures-channel", "futures-core", @@ -857,15 +906,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -873,9 +916,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" [[package]] name = "hashlink" @@ -883,7 +926,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] @@ -897,9 +940,15 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.5" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hermit-abi" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "hex" @@ -934,24 +983,149 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "httparse" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" + +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", ] [[package]] -name = "indexmap" -version = "1.9.3" +name = "idna_adapter" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" dependencies = [ - "autocfg", - "hashbrown 0.12.3", + "icu_normalizer", + "icu_properties", ] [[package]] @@ -961,27 +1135,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.1", ] [[package]] name = "insta" -version = "1.34.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d64600be34b2fcfc267740a243fa7744441bb4947a619ac4e5bb6507f35fbfc" +checksum = "7e9ffc4d4892617c50a928c52b2961cb5174b6fc6ebf252b2fac9d21955c48b8" dependencies = [ "console", "lazy_static", "linked-hash-map", "similar", - "yaml-rust", ] [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] @@ -992,7 +1165,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", "windows-sys 0.48.0", ] @@ -1006,26 +1179,17 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "540654e97a3f4470a492cd30ff187bc95d89557a903a2bbf112e2fae98104ef2" [[package]] name = "js-sys" -version = "0.3.68" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1041,11 +1205,11 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin 0.5.2", + "spin", ] [[package]] @@ -1056,25 +1220,25 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" [[package]] name = "libloading" -version = "0.8.1" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-sys 0.48.0", + "windows-targets 0.52.6", ] [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "libredox" @@ -1082,7 +1246,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "libc", ] @@ -1118,15 +1282,21 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "litemap" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -1134,18 +1304,18 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" dependencies = [ "value-bag", ] [[package]] name = "lsp-server" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248f65b78f6db5d8e1b1604b4098a28b43d21a8eb1deeca22b1c421b276c7095" +checksum = "550446e84739dcaf6d48a4a093973850669e13e8a34d8f8d64851041be267cd9" dependencies = [ "crossbeam-channel", "log", @@ -1155,9 +1325,22 @@ dependencies = [ [[package]] name = "lsp-types" -version = "0.95.0" +version = "0.94.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158c1911354ef73e8fe42da6b10c0484cb65c7f1007f28022e847706c1ab6984" +checksum = "c66bfd44a06ae10647fe3f8214762e9369fd4248df1350924b4ef9e770a85ea1" +dependencies = [ + "bitflags 1.3.2", + "serde", + "serde_json", + "serde_repr", + "url", +] + +[[package]] +name = "lsp-types" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e34d33a8e9b006cd3fc4fe69a921affa097bae4bb65f76271f4644f9a334365" dependencies = [ "bitflags 1.3.2", "serde", @@ -1178,9 +1361,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "minimal-lexical" @@ -1190,11 +1373,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -1203,17 +1386,6 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" -[[package]] -name = "nix" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" -dependencies = [ - "bitflags 2.4.2", - "cfg-if", - "libc", -] - [[package]] name = "nom" version = "7.1.3" @@ -1257,6 +1429,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint-dig" version = "0.8.4" @@ -1291,9 +1473,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -1302,9 +1484,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -1316,15 +1498,24 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] +[[package]] +name = "object" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "option-ext" @@ -1332,17 +1523,23 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parking" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -1350,22 +1547,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "peeking_take_while" @@ -1390,12 +1587,12 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.6.0", + "indexmap", ] [[package]] @@ -1518,7 +1715,7 @@ dependencies = [ "dashmap", "line_index", "lsp-server", - "lsp-types", + "lsp-types 0.95.1", "pg_base_db", "pg_commands", "pg_completions", @@ -1533,6 +1730,11 @@ dependencies = [ "sqlx", "text-size", "threadpool", + "tokio", + "tokio-util", + "tower-lsp", + "tracing", + "tracing-subscriber", ] [[package]] @@ -1543,7 +1745,7 @@ checksum = "d62d572612b3aa26c454f27f2a3d94c19b7d10edcca957c1d23767a8f3fbccb6" dependencies = [ "bindgen", "fs_extra", - "itertools 0.10.5", + "itertools", "prost", "prost-build", "serde", @@ -1654,11 +1856,31 @@ dependencies = [ "tree_sitter_sql", ] +[[package]] +name = "pin-project" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -1668,12 +1890,12 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "piper" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", - "fastrand 2.0.1", + "fastrand 2.2.0", "futures-io", ] @@ -1700,9 +1922,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "polling" @@ -1722,16 +1944,17 @@ dependencies = [ [[package]] name = "polling" -version = "3.4.0" +version = "3.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30054e72317ab98eddd8561db0f6524df3367636884b7b21b703e4b280a84a14" +checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" dependencies = [ "cfg-if", "concurrent-queue", + "hermit-abi 0.4.0", "pin-project-lite", - "rustix 0.38.31", + "rustix 0.38.41", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1742,18 +1965,21 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "prettyplease" -version = "0.2.16" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.71", + "syn 2.0.89", ] [[package]] @@ -1767,9 +1993,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -1794,7 +2020,7 @@ dependencies = [ "cfg-if", "cmake", "heck", - "itertools 0.10.5", + "itertools", "lazy_static", "log", "multimap", @@ -1813,7 +2039,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools", "proc-macro2", "quote", "syn 1.0.109", @@ -1831,9 +2057,9 @@ dependencies = [ [[package]] name = "protobuf" -version = "3.3.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65f4a8ec18723a734e5dc09c173e0abf9690432da5340285d536edcb4dac190" +checksum = "a3a7c64d9bf75b1b8d981124c14c179074e8caa7dfe7b6a12e6222ddcd0c8f72" dependencies = [ "once_cell", "protobuf-support", @@ -1842,12 +2068,12 @@ dependencies = [ [[package]] name = "protobuf-parse" -version = "3.3.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77d6fbd6697c9e531873e81cec565a85e226b99a0f10e1acc079be057fe2fcba" +checksum = "322330e133eab455718444b4e033ebfac7c6528972c784fcde28d2cc783c6257" dependencies = [ "anyhow", - "indexmap 1.9.3", + "indexmap", "log", "protobuf", "protobuf-support", @@ -1858,18 +2084,18 @@ dependencies = [ [[package]] name = "protobuf-support" -version = "3.3.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6872f4d4f4b98303239a2b5838f5bbbb77b01ffc892d627957f37a22d7cfe69c" +checksum = "b088fd20b938a875ea00843b6faf48579462630015c3788d397ad6a786663252" dependencies = [ "thiserror", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -1906,11 +2132,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", ] [[package]] @@ -1926,9 +2152,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -1938,9 +2164,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -1949,22 +2175,23 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom", "libc", - "spin 0.9.8", + "spin", "untrusted", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1987,6 +2214,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -2009,22 +2242,22 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "errno", "libc", - "linux-raw-sys 0.4.13", + "linux-raw-sys 0.4.14", "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.21.10" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "ring", "rustls-webpki", @@ -2052,9 +2285,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scopeguard" @@ -2074,31 +2307,32 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.89", ] [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -2114,13 +2348,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.89", ] [[package]] @@ -2145,6 +2379,15 @@ dependencies = [ "digest", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shlex" version = "1.3.0" @@ -2163,9 +2406,9 @@ dependencies = [ [[package]] name = "similar" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21" +checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e" [[package]] name = "slab" @@ -2178,9 +2421,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -2192,12 +2435,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -2225,20 +2462,19 @@ checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" [[package]] name = "sqlformat" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" +checksum = "7bba3a93db0cc4f7bdece8bb09e77e2e785c20bfebf79eb8340ed80708048790" dependencies = [ - "itertools 0.12.1", "nom", "unicode_categories", ] [[package]] name = "sqlx" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf" +checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" dependencies = [ "sqlx-core", "sqlx-macros", @@ -2249,9 +2485,9 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" +checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" dependencies = [ "ahash", "async-io 1.13.0", @@ -2261,7 +2497,6 @@ dependencies = [ "bytes", "crc", "crossbeam-queue", - "dotenvy", "either", "event-listener 2.5.3", "futures-channel", @@ -2271,7 +2506,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap 2.6.0", + "indexmap", "log", "memchr", "once_cell", @@ -2292,9 +2527,9 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5" +checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" dependencies = [ "proc-macro2", "quote", @@ -2305,12 +2540,11 @@ dependencies = [ [[package]] name = "sqlx-macros-core" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841" +checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" dependencies = [ "async-std", - "atomic-write-file", "dotenvy", "either", "heck", @@ -2332,13 +2566,13 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" +checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" dependencies = [ "atoi", "base64", - "bitflags 2.4.2", + "bitflags 2.6.0", "byteorder", "bytes", "crc", @@ -2374,13 +2608,13 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" +checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" dependencies = [ "atoi", "base64", - "bitflags 2.4.2", + "bitflags 2.6.0", "byteorder", "crc", "dotenvy", @@ -2401,7 +2635,6 @@ dependencies = [ "rand", "serde", "serde_json", - "sha1", "sha2", "smallvec", "sqlx-core", @@ -2413,9 +2646,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490" +checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" dependencies = [ "atoi", "flume", @@ -2442,20 +2675,20 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "stringprep" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" dependencies = [ - "finl_unicode", "unicode-bidi", "unicode-normalization", + "unicode-properties", ] [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -2470,25 +2703,37 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.71" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + [[package]] name = "tempfile" -version = "3.10.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", - "fastrand 2.0.1", - "rustix 0.38.31", - "windows-sys 0.52.0", + "fastrand 2.2.0", + "once_cell", + "rustix 0.38.41", + "windows-sys 0.59.0", ] [[package]] @@ -2499,22 +2744,32 @@ checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.89", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", ] [[package]] @@ -2528,9 +2783,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "num-conv", @@ -2545,11 +2800,21 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -2560,6 +2825,41 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "1.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +dependencies = [ + "backtrace", + "pin-project-lite", + "tokio-macros", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + +[[package]] +name = "tokio-util" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml_datetime" version = "0.6.8" @@ -2572,11 +2872,71 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.6.0", + "indexmap", "toml_datetime", "winnow", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-lsp" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ba052b54a6627628d9b3c34c176e7eda8359b7da9acd497b9f20998d118508" +dependencies = [ + "async-trait", + "auto_impl", + "bytes", + "dashmap", + "futures", + "httparse", + "lsp-types 0.94.1", + "memchr", + "serde", + "serde_json", + "tokio", + "tokio-util", + "tower", + "tower-lsp-macros", + "tracing", +] + +[[package]] +name = "tower-lsp-macros" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + [[package]] name = "tracing" version = "0.1.40" @@ -2597,7 +2957,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.89", ] [[package]] @@ -2607,6 +2967,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", ] [[package]] @@ -2629,9 +3015,9 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.11" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" +checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85" dependencies = [ "stable_deref_trait", ] @@ -2644,30 +3030,36 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode_categories" @@ -2683,9 +3075,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -2699,11 +3091,29 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "value-bag" -version = "1.7.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126e423afe2dd9ac52142e7e9d5ce4135d7e13776c529d27fd6bc49f19e3280b" +checksum = "3ef4c4aa54d5d05a279399bfa921ec387b7aba77caf7a682ae8d86785b8fdad2" [[package]] name = "vcpkg" @@ -2713,15 +3123,15 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "waker-fn" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" [[package]] name = "wasi" @@ -2729,36 +3139,43 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" -version = "0.2.91" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.91" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.89", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.41" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -2768,9 +3185,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.91" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2778,28 +3195,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.91" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.89", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.91" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "web-sys" -version = "0.3.68" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -2820,14 +3237,18 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.31", + "rustix 0.38.41", ] [[package]] name = "whoami" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" +checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" +dependencies = [ + "redox_syscall", + "wasite", +] [[package]] name = "winapi" @@ -2866,7 +3287,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -2886,17 +3316,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2907,9 +3338,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -2919,9 +3350,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -2931,9 +3362,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -2943,9 +3380,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -2955,9 +3392,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -2967,9 +3404,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -2979,9 +3416,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" @@ -2998,6 +3435,18 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23f6174b2566cc4a74f95e1367ec343e7fa80c93cc8087f5c4a3d6a1088b2118" +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "xflags" version = "0.3.2" @@ -3015,18 +3464,18 @@ checksum = "672423d4fea7ffa2f6c25ba60031ea13dc6258070556f125cc4d790007d4a155" [[package]] name = "xshell" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce2107fe03e558353b4c71ad7626d58ed82efaf56c54134228608893c77023ad" +checksum = "9e7290c623014758632efe00737145b6867b66292c42167f2ec381eb566a373d" dependencies = [ "xshell-macros", ] [[package]] name = "xshell-macros" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e2c411759b501fb9501aac2b1b2d287a6e93e5bdcf13c25306b23e1b716dd0e" +checksum = "32ac00cd3f8ec9c1d33fb3e7958a82df6989c42d747bd326c822b1d625283547" [[package]] name = "xtask" @@ -3042,39 +3491,98 @@ dependencies = [ ] [[package]] -name = "yaml-rust" -version = "0.4.5" +name = "yoke" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" dependencies = [ - "linked-hash-map", + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", + "synstructure", ] [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.89", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", + "synstructure", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.89", +] [[package]] name = "zip" diff --git a/Cargo.toml b/Cargo.toml index 0ccfa3dd..a3219565 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,6 @@ pg_hover = { path = "./crates/pg_hover", version = "0.0.0" } pg_inlay_hints = { path = "./crates/pg_inlay_hints", version = "0.0.0" } pg_lint = { path = "./crates/pg_lint", version = "0.0.0" } pg_workspace = { path = "./crates/pg_workspace", version = "0.0.0" } -pg_lsp = { path = "./crates/lsp", version = "0.0.0" } # parser = { path = "./crates/parser", version = "0.0.0" } # sql_parser = { path = "./crates/sql_parser", version = "0.0.0" } @@ -45,4 +44,3 @@ pg_lsp = { path = "./crates/lsp", version = "0.0.0" } [profile.dev.package] insta.opt-level = 3 -similar.opt-level = 3 diff --git a/crates/pg_lsp/Cargo.toml b/crates/pg_lsp/Cargo.toml index fb007862..76dde337 100644 --- a/crates/pg_lsp/Cargo.toml +++ b/crates/pg_lsp/Cargo.toml @@ -33,6 +33,11 @@ pg_base_db.workspace = true pg_schema_cache.workspace = true pg_workspace.workspace = true pg_diagnostics.workspace = true +tokio = { version = "1.40.0", features = ["io-std", "macros", "rt-multi-thread", "sync", "time"] } +tokio-util = "0.7.12" +tower-lsp = "0.20.0" +tracing = "0.1.40" +tracing-subscriber = "0.3.18" [dev-dependencies] diff --git a/crates/pg_lsp/src/client.rs b/crates/pg_lsp/src/client.rs deleted file mode 100644 index 85ff5a61..00000000 --- a/crates/pg_lsp/src/client.rs +++ /dev/null @@ -1,121 +0,0 @@ -pub mod client_flags; - -use std::{ - collections::HashMap, - sync::{ - atomic::{AtomicI32, Ordering}, - Arc, Mutex, - }, -}; - -use anyhow::{bail, Result}; -use crossbeam_channel::Sender; -use lsp_server::{ErrorCode, Message, Request, RequestId, Response}; -use lsp_types::{notification::ShowMessage, MessageType, ShowMessageParams}; -use serde::{de::DeserializeOwned, Serialize}; - -use crate::server::options::Options; - -#[derive(Debug)] -struct RawClient { - sender: Sender, - next_id: AtomicI32, - pending: Mutex>>, -} - -#[derive(Debug, Clone)] -pub struct LspClient { - raw: Arc, -} - -impl LspClient { - pub fn new(sender: Sender) -> Self { - let raw = Arc::new(RawClient { - sender, - next_id: AtomicI32::new(1), - pending: Default::default(), - }); - - Self { raw } - } - - pub fn send_notification(&self, params: N::Params) -> Result<()> - where - N: lsp_types::notification::Notification, - N::Params: Serialize, - { - self.raw - .sender - .send(lsp_server::Notification::new(N::METHOD.to_string(), params).into())?; - Ok(()) - } - - pub fn send_request(&self, params: R::Params) -> Result - where - R: lsp_types::request::Request, - R::Params: Serialize, - R::Result: DeserializeOwned, - { - let id = RequestId::from(self.raw.next_id.fetch_add(1, Ordering::SeqCst)); - - let (tx, rx) = crossbeam_channel::bounded(1); - self.raw.pending.lock().unwrap().insert(id.clone(), tx); - - self.raw - .sender - .send(Request::new(id, R::METHOD.to_string(), params).into())?; - - let response = rx.recv()?; - let result = match response.error { - Some(error) => bail!(error.message), - None => response.result.unwrap_or_default(), - }; - - Ok(serde_json::from_value(result)?) - } - - pub fn send_response(&self, response: lsp_server::Response) -> Result<()> { - self.raw.sender.send(response.into())?; - Ok(()) - } - - pub fn send_error(&self, id: RequestId, code: ErrorCode, message: String) -> Result<()> { - self.send_response(lsp_server::Response::new_err(id, code as i32, message))?; - Ok(()) - } - - pub fn recv_response(&self, response: lsp_server::Response) -> Result<()> { - let tx = self - .raw - .pending - .lock() - .unwrap() - .remove(&response.id) - .expect("response with known request id received"); - - tx.send(response)?; - Ok(()) - } - - pub fn parse_options(&self, mut value: serde_json::Value) -> Result { - // if there are multiple servers, we need to extract the options for pglsp first - let options = match value.get_mut("pglsp") { - Some(section) => section.take(), - None => value, - }; - - let options = match serde_json::from_value(options) { - Ok(new_options) => new_options, - Err(why) => { - let message = format!( - "The texlab configuration is invalid; using the default settings instead.\nDetails: {why}" - ); - let typ = MessageType::WARNING; - self.send_notification::(ShowMessageParams { message, typ })?; - None - } - }; - - Ok(options.unwrap_or_default()) - } -} diff --git a/crates/pg_lsp/src/client/client_config_opts.rs b/crates/pg_lsp/src/client/client_config_opts.rs new file mode 100644 index 00000000..3d29e986 --- /dev/null +++ b/crates/pg_lsp/src/client/client_config_opts.rs @@ -0,0 +1,7 @@ +use serde::Deserialize; + +// TODO: Check that the Opts are correct (existed in server.rs) +#[derive(Deserialize)] +pub struct ClientConfigurationOptions { + pub db_connection_string: Option, +} diff --git a/crates/pg_lsp/src/client/client_flags.rs b/crates/pg_lsp/src/client/client_flags.rs index 8fca812d..f8ef2445 100644 --- a/crates/pg_lsp/src/client/client_flags.rs +++ b/crates/pg_lsp/src/client/client_flags.rs @@ -1,10 +1,22 @@ +use tower_lsp::lsp_types::InitializeParams; + /// Contains information about the client's capabilities. /// This is used to determine which features the server can use. #[derive(Debug, Clone)] pub struct ClientFlags { - /// If `true`, the server can pull the configuration from the client. - pub configuration_pull: bool, + /// If `true`, the server can pull configuration from the client. + pub supports_pull_opts: bool, +} + +impl ClientFlags { + pub(crate) fn from_initialize_request_params(params: &InitializeParams) -> Self { + let supports_pull_opts = params + .capabilities + .workspace + .as_ref() + .and_then(|w| w.configuration) + .unwrap_or(false); - /// If `true`, the client notifies the server when the configuration changes. - pub configuration_push: bool, + Self { supports_pull_opts } + } } diff --git a/crates/pg_lsp/src/client/mod.rs b/crates/pg_lsp/src/client/mod.rs new file mode 100644 index 00000000..63472a43 --- /dev/null +++ b/crates/pg_lsp/src/client/mod.rs @@ -0,0 +1,2 @@ +pub mod client_config_opts; +pub mod client_flags; diff --git a/crates/pg_lsp/src/db_connection.rs b/crates/pg_lsp/src/db_connection.rs new file mode 100644 index 00000000..493eeb64 --- /dev/null +++ b/crates/pg_lsp/src/db_connection.rs @@ -0,0 +1,79 @@ +use std::sync::Arc; + +use pg_schema_cache::SchemaCache; +use pg_workspace::Workspace; +use sqlx::{postgres::PgListener, PgPool}; +use tokio::{sync::RwLock, task::JoinHandle}; + +pub(crate) struct DbConnection { + pool: PgPool, + connection_string: String, + schema_update_handle: JoinHandle<()>, + close_tx: tokio::sync::oneshot::Sender<()>, +} + +impl DbConnection { + pub(crate) async fn new( + connection_string: String, + ide: Arc>, + ) -> Result { + let pool = PgPool::connect(&connection_string).await?; + + let mut listener = PgListener::connect_with(&pool).await?; + listener.listen_all(["postgres_lsp", "pgrst"]).await?; + + let (close_tx, close_rx) = tokio::sync::oneshot::channel::<()>(); + + let cloned_pool = pool.clone(); + + let schema_update_handle: JoinHandle<()> = tokio::spawn(async move { + let mut moved_rx = close_rx; + + loop { + tokio::select! { + res = listener.recv() => { + match res { + Ok(not) => { + if not.payload().to_string() == "reload schema" { + let schema_cache = SchemaCache::load(&cloned_pool).await; + ide.write().await.set_schema_cache(schema_cache); + }; + } + Err(why) => { + eprintln!("Error receiving notification: {:?}", why); + break; + } + } + } + + _ = &mut moved_rx => { + return; + } + } + } + }); + + Ok(Self { + pool, + connection_string: connection_string, + schema_update_handle, + close_tx, + }) + } + + pub(crate) fn connected_to(&self, connection_string: &str) -> bool { + connection_string == self.connection_string + } + + #[tracing::instrument(name = "Closing DB Pool", skip(self))] + pub(crate) async fn close(self) { + let _ = self.close_tx.send(()); + let _ = self.schema_update_handle.await; + + self.pool.close().await; + } + + pub(crate) fn get_pool(&self) -> PgPool { + self.pool.clone() + } +} diff --git a/crates/pg_lsp/src/debouncer.rs b/crates/pg_lsp/src/debouncer.rs new file mode 100644 index 00000000..61f17bf3 --- /dev/null +++ b/crates/pg_lsp/src/debouncer.rs @@ -0,0 +1,86 @@ +use std::{ + future::Future, + pin::Pin, + sync::{atomic::AtomicBool, Arc}, +}; + +type AsyncBlock = Pin + 'static + Send>>; + +pub(crate) struct SimpleTokioDebouncer { + handle: tokio::task::JoinHandle<()>, + tx: tokio::sync::mpsc::Sender, + shutdown_flag: Arc, +} + +impl SimpleTokioDebouncer { + pub fn new(timeout: std::time::Duration) -> Self { + let (tx, mut rx) = tokio::sync::mpsc::channel(100); + + let shutdown_flag = Arc::new(AtomicBool::new(false)); + let shutdown_flag_clone = shutdown_flag.clone(); + + let handle = tokio::spawn(async move { + let mut maybe_args: Option = None; + let mut instant = tokio::time::Instant::now() + timeout; + + loop { + if shutdown_flag_clone.load(std::sync::atomic::Ordering::Relaxed) { + break; + } + + tokio::select! { + // If the timeout is reached, execute and reset the last received action + _ = tokio::time::sleep_until(instant) => { + match maybe_args { + Some(block) => { + block.await; + maybe_args = None; + } + None => continue, + } + } + + // If a new action is received, update the action and reset the timeout + cb = rx.recv() => { + match cb { + Some(cb) => { + maybe_args = Some(cb); + instant = tokio::time::Instant::now() + timeout; + } + None => break, // channel closed + } + } + } + } + }); + + Self { + handle, + tx, + shutdown_flag, + } + } + + #[tracing::instrument(name = "Adding task to debouncer", skip(self, block))] + pub async fn debounce(&self, block: AsyncBlock) { + if self + .shutdown_flag + .load(std::sync::atomic::Ordering::Relaxed) + { + tracing::error!( + "Trying to debounce tasks, but the Debouncer is in the process of shutting down." + ); + return; + } + + self.tx.send(block).await.unwrap(); + } + + #[tracing::instrument(name = "Shutting down debouncer", skip(self))] + pub async fn shutdown(&self) { + self.shutdown_flag + .store(true, std::sync::atomic::Ordering::Relaxed); + + let _ = self.handle.abort(); // we don't care about any errors during shutdown + } +} diff --git a/crates/pg_lsp/src/lib.rs b/crates/pg_lsp/src/lib.rs index ac95c913..579d584a 100644 --- a/crates/pg_lsp/src/lib.rs +++ b/crates/pg_lsp/src/lib.rs @@ -1,3 +1,6 @@ mod client; +mod db_connection; +mod debouncer; pub mod server; +mod session; mod utils; diff --git a/crates/pg_lsp/src/main.rs b/crates/pg_lsp/src/main.rs index eb5eddb6..ea366fb6 100644 --- a/crates/pg_lsp/src/main.rs +++ b/crates/pg_lsp/src/main.rs @@ -1,10 +1,31 @@ -use lsp_server::Connection; -use pg_lsp::server::Server; +use std::{fs::File, path::PathBuf, str::FromStr}; -fn main() -> anyhow::Result<()> { - let (connection, threads) = Connection::stdio(); - Server::init(connection)?; - threads.join()?; +use pg_lsp::server::LspServer; +use tower_lsp::{LspService, Server}; +use tracing_subscriber::fmt::format::FmtSpan; + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + let path = PathBuf::from_str("pglsp.log").expect("Opened the log file."); + let file = File::create(path).expect("Could not open the file."); + + let subscriber = tracing_subscriber::FmtSubscriber::builder() + .with_span_events(FmtSpan::ENTER) + .with_span_events(FmtSpan::CLOSE) + .with_ansi(false) + .with_writer(file) + .finish(); + + tracing::subscriber::set_global_default(subscriber)?; + + let stdin = tokio::io::stdin(); + let stdout = tokio::io::stdout(); + + tracing::info!("Starting server."); + + let (service, socket) = LspService::new(|client| LspServer::new(client)); + + Server::new(stdin, stdout, socket).serve(service).await; Ok(()) } diff --git a/crates/pg_lsp/src/server.rs b/crates/pg_lsp/src/server.rs index 927d7f16..a3c9e8fb 100644 --- a/crates/pg_lsp/src/server.rs +++ b/crates/pg_lsp/src/server.rs @@ -1,891 +1,511 @@ -mod debouncer; -mod dispatch; -pub mod options; - -use async_std::task::{self}; -use crossbeam_channel::{unbounded, Receiver, Sender}; -use lsp_server::{Connection, ErrorCode, Message, RequestId}; -use lsp_types::{ - notification::{ - DidChangeConfiguration, DidChangeTextDocument, DidCloseTextDocument, DidOpenTextDocument, - DidSaveTextDocument, Notification as _, PublishDiagnostics, ShowMessage, - }, - request::{ - CodeActionRequest, Completion, ExecuteCommand, HoverRequest, InlayHintRequest, - RegisterCapability, WorkspaceConfiguration, - }, - CompletionList, CompletionOptions, ConfigurationItem, ConfigurationParams, - DidChangeConfigurationParams, DidChangeTextDocumentParams, DidCloseTextDocumentParams, - DidOpenTextDocumentParams, DidSaveTextDocumentParams, ExecuteCommandOptions, - ExecuteCommandParams, HoverProviderCapability, InitializeParams, InitializeResult, - PublishDiagnosticsParams, Registration, RegistrationParams, SaveOptions, ServerCapabilities, - ServerInfo, ShowMessageParams, TextDocumentSyncCapability, TextDocumentSyncKind, - TextDocumentSyncOptions, TextDocumentSyncSaveOptions, -}; -use pg_base_db::{Change, DocumentChange}; -use pg_commands::{Command, CommandType, ExecuteStatementCommand}; -use pg_completions::CompletionParams; -use pg_hover::HoverParams; -use pg_schema_cache::SchemaCache; -use pg_workspace::Workspace; -use serde::{de::DeserializeOwned, Serialize}; -use std::{collections::HashSet, sync::Arc, time::Duration}; -use text_size::TextSize; -use threadpool::ThreadPool; - -use crate::{ - client::{client_flags::ClientFlags, LspClient}, - utils::{file_path, from_proto, line_index_ext::LineIndexExt, normalize_uri, to_proto}, -}; - -use self::{debouncer::EventDebouncer, options::Options}; -use sqlx::{ - postgres::{PgListener, PgPool}, - Executor, -}; - -#[derive(Debug)] -enum InternalMessage { - PublishDiagnostics(lsp_types::Url), - SetOptions(Options), - RefreshSchemaCache, - SetSchemaCache(SchemaCache), +use std::sync::Arc; + +use notification::ShowMessage; +use pg_commands::CommandType; +use tokio::sync::RwLock; +use tower_lsp::jsonrpc; +use tower_lsp::lsp_types::*; +use tower_lsp::{Client, LanguageServer}; + +use crate::client::client_config_opts::ClientConfigurationOptions; +use crate::client::client_flags::ClientFlags; +use crate::debouncer::SimpleTokioDebouncer; +use crate::session::Session; +use crate::utils::file_path; +use crate::utils::normalize_uri; +use crate::utils::to_proto; + +pub struct LspServer { + client: Arc, + session: Arc, + client_capabilities: RwLock>, + debouncer: SimpleTokioDebouncer, } -#[derive(Debug)] -struct DbConnection { - pub pool: PgPool, - connection_string: String, -} +impl LspServer { + pub fn new(client: Client) -> Self { + tracing::info!("Setting up server."); + let s = Self { + client: Arc::new(client), + session: Arc::new(Session::new()), + client_capabilities: RwLock::new(None), + debouncer: SimpleTokioDebouncer::new(std::time::Duration::from_millis(500)), + }; + tracing::info!("Server setup complete."); -impl DbConnection { - pub async fn new(connection_string: &str) -> Result { - let pool = PgPool::connect(connection_string).await?; - Ok(Self { - pool, - connection_string: connection_string.to_owned(), - }) + s } -} - -pub struct Server { - connection: Arc, - client: LspClient, - internal_tx: Sender, - internal_rx: Receiver, - pool: Arc, - client_flags: Arc, - ide: Arc, - db_conn: Option, - compute_debouncer: EventDebouncer>, -} - -impl Server { - pub fn init(connection: Connection) -> anyhow::Result<()> { - let client = LspClient::new(connection.sender.clone()); - let (internal_tx, internal_rx) = unbounded(); - - let (id, params) = connection.initialize_start()?; - let params: InitializeParams = serde_json::from_value(params)?; - - let result = InitializeResult { - capabilities: Self::capabilities(), - server_info: Some(ServerInfo { - name: "Postgres LSP".to_owned(), - version: Some(env!("CARGO_PKG_VERSION").to_owned()), - }), - }; - - connection.initialize_finish(id, serde_json::to_value(result)?)?; - - let client_flags = Arc::new(from_proto::client_flags(params.capabilities)); - - let pool = Arc::new(threadpool::Builder::new().build()); - - let ide = Arc::new(Workspace::new()); - - let cloned_tx = internal_tx.clone(); - let cloned_ide = ide.clone(); - let cloned_pool = pool.clone(); - let cloned_client = client.clone(); - - let server = Self { - connection: Arc::new(connection), - internal_rx, - internal_tx, - client, - client_flags, - db_conn: None, - ide, - compute_debouncer: EventDebouncer::new( - Duration::from_millis(500), - move |conn: Option| { - let inner_cloned_ide = cloned_ide.clone(); - let inner_cloned_tx = cloned_tx.clone(); - let inner_cloned_client = cloned_client.clone(); - cloned_pool.execute(move || { - inner_cloned_client - .send_notification::(ShowMessageParams { - typ: lsp_types::MessageType::INFO, - message: format!("Computing debounced {}", conn.is_some()), - }) - .unwrap(); - let r = - async_std::task::block_on(conn.as_ref().unwrap().execute("SELECT 1")); - inner_cloned_client - .send_notification::(ShowMessageParams { - typ: lsp_types::MessageType::INFO, - message: format!("res {:?}", r.unwrap()), - }) - .unwrap(); - - let changed = inner_cloned_ide.compute(conn); - - let urls = HashSet::<&str>::from_iter( - changed.iter().map(|f| f.document_url.to_str().unwrap()), - ); - for url in urls.iter() { - inner_cloned_tx - .send(InternalMessage::PublishDiagnostics( - lsp_types::Url::from_file_path(url).unwrap(), - )) - .unwrap(); - } - }); - }, - ), - pool, + /// When the client sends a didChangeConfiguration notification, we need to parse the received JSON. + #[tracing::instrument( + name = "Parsing config from client", + skip(self, value), + fields(options = %value) + )] + async fn parse_config_from_client( + &self, + mut value: serde_json::Value, + ) -> Option { + let options = match value.get_mut("pglsp") { + Some(section) => section.take(), + None => value, }; - server.run()?; - Ok(()) + match serde_json::from_value::(options) { + Ok(new_options) => Some(new_options), + Err(why) => { + let message = format!( + "The texlab configuration is invalid; using the default settings instead.\nDetails: {why}" + ); + let typ = MessageType::WARNING; + self.client + .send_notification::(ShowMessageParams { message, typ }) + .await; + None + } + } } - fn compute_now(&self) { - let conn = self.db_conn.as_ref().map(|p| p.pool.clone()); - let cloned_ide = self.ide.clone(); - let cloned_tx = self.internal_tx.clone(); - let client = self.client.clone(); - - self.compute_debouncer.clear(); - - self.pool.execute(move || { - client - .send_notification::(ShowMessageParams { - typ: lsp_types::MessageType::INFO, - message: format!("Computing now {}", conn.is_some()), - }) - .unwrap(); - - if conn.is_some() { - client - .send_notification::(ShowMessageParams { - typ: lsp_types::MessageType::INFO, - message: format!("pool closed {}", conn.as_ref().unwrap().is_closed()), - }) - .unwrap(); + #[tracing::instrument(name = "Requesting Configuration from Client", skip(self))] + async fn request_config_from_client(&self) -> Option { + let params = ConfigurationParams { + items: vec![ConfigurationItem { + section: Some("pglsp".to_string()), + scope_uri: None, + }], + }; - let r = async_std::task::block_on(conn.as_ref().unwrap().execute("SELECT 1")); - client - .send_notification::(ShowMessageParams { - typ: lsp_types::MessageType::INFO, - message: format!("res {:?}", r.unwrap()), - }) - .unwrap(); + tracing::info!("sending workspace/configuration request"); + match self + .client + .send_request::(params) + .await + { + Ok(json) => { + // The client reponse fits the requested `ConfigurationParams.items`, + // so the first value is what we're looking for. + let relevant = json + .into_iter() + .next() + .expect("workspace/configuration request did not yield expected response."); + + self.parse_config_from_client(relevant).await } - let changed = cloned_ide.compute(conn); - let urls = HashSet::<&str>::from_iter( - changed.iter().map(|f| f.document_url.to_str().unwrap()), - ); - - for url in urls { - cloned_tx - .send(InternalMessage::PublishDiagnostics( - lsp_types::Url::from_file_path(url).unwrap(), - )) - .unwrap(); + Err(why) => { + let message = format!( + "Unable to pull client options via workspace/configuration request: {}", + why + ); + self.client.log_message(MessageType::ERROR, message).await; + None } - }); - } - - fn start_listening(&self) { - if self.db_conn.is_none() { - return; } - - let pool = self.db_conn.as_ref().unwrap().pool.clone(); - let tx = self.internal_tx.clone(); - - task::spawn(async move { - let mut listener = PgListener::connect_with(&pool).await.unwrap(); - listener - .listen_all(["postgres_lsp", "pgrst"]) - .await - .unwrap(); - - loop { - match listener.recv().await { - Ok(notification) => { - if notification.payload().to_string() == "reload schema" { - tx.send(InternalMessage::RefreshSchemaCache).unwrap(); - } - } - Err(e) => { - eprintln!("Listener error: {}", e); - break; - } - } - } - }); } - async fn update_db_connection(&mut self, connection_string: Option) { - if connection_string == self.db_conn.as_ref().map(|c| c.connection_string.clone()) { - return; - } - if let Some(conn) = self.db_conn.take() { - conn.pool.close().await; - } - - if connection_string.is_none() { - return; - } - - let new_conn = DbConnection::new(connection_string.unwrap().as_str()).await; + #[tracing::instrument( + name="Publishing diagnostics", + skip(self, uri), + fields(%uri) + )] + async fn publish_diagnostics(&self, mut uri: Url) { + normalize_uri(&mut uri); - if new_conn.is_err() { - return; - } + let url = file_path(&uri); + let diagnostics = self.session.get_diagnostics(url).await; - self.db_conn = Some(new_conn.unwrap()); + let diagnostics: Vec = diagnostics + .into_iter() + .map(|(d, r)| to_proto::diagnostic(d, r)) + .collect(); self.client .send_notification::(ShowMessageParams { - typ: lsp_types::MessageType::INFO, - message: "Connection to database established".to_string(), + typ: MessageType::INFO, + message: format!("diagnostics {}", diagnostics.len()), }) - .unwrap(); + .await; - self.refresh_schema_cache(); + let params = PublishDiagnosticsParams { + uri, + diagnostics, + version: None, + }; - self.start_listening(); + self.client + .send_notification::(params) + .await; } - fn update_options(&mut self, options: Options) { - async_std::task::block_on(self.update_db_connection(options.db_connection_string)); - } + #[tracing::instrument( + name="Publishing diagnostics via Debouncer", + skip(self, uri), + fields(%uri) + )] + async fn publish_diagnostics_debounced(&self, mut uri: Url) { + let client = Arc::clone(&self.client); + let session = Arc::clone(&self.session); - fn capabilities() -> ServerCapabilities { - ServerCapabilities { - text_document_sync: Some(TextDocumentSyncCapability::Options( - TextDocumentSyncOptions { - open_close: Some(true), - change: Some(TextDocumentSyncKind::INCREMENTAL), - will_save: None, - will_save_wait_until: None, - save: Some(TextDocumentSyncSaveOptions::SaveOptions(SaveOptions { - include_text: Some(false), - })), - }, - )), - hover_provider: Some(HoverProviderCapability::Simple(true)), - execute_command_provider: Some(ExecuteCommandOptions { - commands: CommandType::ALL - .iter() - .map(|c| c.id().to_string()) - .collect(), - ..Default::default() - }), - inlay_hint_provider: Some(lsp_types::OneOf::Left(true)), - code_action_provider: Some(lsp_types::CodeActionProviderCapability::Simple(true)), - completion_provider: Some(CompletionOptions::default()), - ..ServerCapabilities::default() - } - } + self.debouncer + .debounce(Box::pin(async move { + normalize_uri(&mut uri); + let url = file_path(&uri); - // TODO allow option url and publish diagnostics for all files - fn publish_diagnostics(&self, uri: lsp_types::Url) -> anyhow::Result<()> { - let mut url = uri.clone(); - normalize_uri(&mut url); + let diagnostics = session.get_diagnostics(url).await; - let path = file_path(&url); + let diagnostics: Vec = diagnostics + .into_iter() + .map(|(d, r)| to_proto::diagnostic(d, r)) + .collect(); - let doc = self.ide.documents.get(&path); + client + .send_notification::(ShowMessageParams { + typ: MessageType::INFO, + message: format!("diagnostics {}", diagnostics.len()), + }) + .await; - if doc.is_none() { - return Ok(()); - } + let params = PublishDiagnosticsParams { + uri, + diagnostics, + version: None, + }; - let diagnostics: Vec = self - .ide - .diagnostics(&path) - .iter() - .map(|d| to_proto::diagnostic(&doc.as_ref().unwrap(), d)) - .collect(); + client + .send_notification::(params) + .await; + })) + .await; + } +} +#[tower_lsp::async_trait] +impl LanguageServer for LspServer { + #[tracing::instrument(name = "initialize", skip(self, params))] + async fn initialize(&self, params: InitializeParams) -> jsonrpc::Result { self.client - .send_notification::(ShowMessageParams { - typ: lsp_types::MessageType::INFO, - message: format!("diagnostics {}", diagnostics.len()), - }) - .unwrap(); + .show_message(MessageType::INFO, "Initialize Request received") + .await; + let flags = ClientFlags::from_initialize_request_params(¶ms); + self.client_capabilities.write().await.replace(flags); + + Ok(InitializeResult { + server_info: None, + capabilities: ServerCapabilities { + text_document_sync: Some(TextDocumentSyncCapability::Options( + TextDocumentSyncOptions { + open_close: Some(true), + change: Some(TextDocumentSyncKind::INCREMENTAL), + will_save: None, + will_save_wait_until: None, + save: Some(TextDocumentSyncSaveOptions::SaveOptions(SaveOptions { + include_text: Some(false), + })), + }, + )), + hover_provider: Some(HoverProviderCapability::Simple(true)), + execute_command_provider: Some(ExecuteCommandOptions { + commands: CommandType::ALL + .iter() + .map(|c| c.id().to_string()) + .collect(), + ..Default::default() + }), + inlay_hint_provider: Some(OneOf::Left(true)), + code_action_provider: Some(CodeActionProviderCapability::Simple(true)), + completion_provider: Some(CompletionOptions::default()), + ..ServerCapabilities::default() + }, + }) + } - let params = PublishDiagnosticsParams { - uri, - diagnostics, - version: None, - }; + #[tracing::instrument(name = "initialized", skip(self, _params))] + async fn initialized(&self, _params: InitializedParams) { + self.client + .log_message(MessageType::INFO, "Postgres LSP Connected!") + .await; + } + + #[tracing::instrument(name = "shutdown", skip(self))] + async fn shutdown(&self) -> jsonrpc::Result<()> { + self.session.shutdown().await; + self.debouncer.shutdown().await; self.client - .send_notification::(params)?; + .send_notification::(ShowMessageParams { + message: "Shutdown successful.".into(), + typ: MessageType::INFO, + }) + .await; Ok(()) } - fn did_open(&self, params: DidOpenTextDocumentParams) -> anyhow::Result<()> { + #[tracing::instrument(name = "workspace/didChangeConfiguration", skip(self, params))] + async fn did_change_configuration(&self, params: DidChangeConfigurationParams) { + let capabilities = self.client_capabilities.read().await; + + if capabilities.as_ref().unwrap().supports_pull_opts { + let opts = self.request_config_from_client().await; + if opts + .as_ref() + .is_some_and(|o| o.db_connection_string.is_some()) + { + let conn_str = opts.unwrap().db_connection_string.unwrap(); + match self.session.change_db(conn_str).await { + Ok(_) => {} + Err(err) => { + self.client + .show_message( + MessageType::ERROR, + format!("Pulled Client Options but failed to set them: {}", err), + ) + .await + } + } + return; + } + } + + // if we couldn't pull settings from the client, + // we'll try parsing the passed in params. + let opts = self.parse_config_from_client(params.settings).await; + + if opts + .as_ref() + .is_some_and(|o| o.db_connection_string.is_some()) + { + let conn_str = opts.unwrap().db_connection_string.unwrap(); + match self.session.change_db(conn_str).await { + Ok(_) => {} + Err(err) => { + self.client + .show_message( + MessageType::ERROR, + format!( + "Used Client Options from params but failed to set them: {}", + err + ), + ) + .await + } + } + } + } + + #[tracing::instrument( + name = "textDocument/didOpen", + skip(self, params), + fields( + uri = %params.text_document.uri + ) + )] + async fn did_open(&self, params: DidOpenTextDocumentParams) { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - let path = file_path(&uri); - - self.ide.apply_change( - path, - DocumentChange::new( + let changed_urls = self + .session + .apply_doc_changes( + file_path(&uri), params.text_document.version, - vec![Change { - range: None, - text: params.text_document.text, - }], - ), - ); - - self.compute_now(); + params.text_document.text, + ) + .await; - Ok(()) + for url in changed_urls { + let url = Url::from_file_path(url.as_path()).expect("Expected absolute File Path"); + self.publish_diagnostics(url).await; + } } - fn did_change(&self, params: DidChangeTextDocumentParams) -> anyhow::Result<()> { + #[tracing::instrument( + name= "textDocument/didSave", + skip(self, params), + fields( + uri = %params.text_document.uri + ) + )] + async fn did_save(&self, params: DidSaveTextDocumentParams) { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - let path = file_path(&uri); - - let document = self.ide.documents.get(&path); - - if document.is_none() { - return Ok(()); - } + self.publish_diagnostics(uri).await; - let changes = from_proto::content_changes(&document.unwrap(), params.content_changes); + // TODO: "Compute Now" + let changed_urls = self.session.recompute_and_get_changed_files().await; + for url in changed_urls { + let url = Url::from_file_path(url.as_path()).expect("Expected absolute File Path"); - self.ide.apply_change( - path, - DocumentChange::new(params.text_document.version, changes), - ); + tracing::info!("publishing diagnostics: {}", url); - let conn = self.db_conn.as_ref().map(|p| p.pool.clone()); - self.compute_debouncer.put(conn); - - Ok(()) + self.publish_diagnostics(url).await; + } } - fn did_save(&self, params: DidSaveTextDocumentParams) -> anyhow::Result<()> { + #[tracing::instrument( + name= "textDocument/didChange", + skip(self, params), + fields( + uri = %params.text_document.uri + ) + )] + async fn did_change(&self, params: DidChangeTextDocumentParams) { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - self.publish_diagnostics(uri)?; - - self.compute_now(); + tracing::info!("{}", uri); - Ok(()) + self.publish_diagnostics_debounced(uri).await; } - fn did_close(&self, params: DidCloseTextDocumentParams) -> anyhow::Result<()> { - // this just means that the document is no longer open in the client - // if we would listen to fs events, we would use this to overwrite the files owner to be - // "server" instead of "client". for now we will ignore this notification since we dont - // need to watch files that are not open. - + #[tracing::instrument( + name= "textDocument/didClose", + skip(self, params), + fields( + uri = %params.text_document.uri + ) + )] + async fn did_close(&self, params: DidCloseTextDocumentParams) { let mut uri = params.text_document.uri; normalize_uri(&mut uri); let path = file_path(&uri); - self.ide.remove_document(path); - - Ok(()) + self.session.on_file_closed(path).await } - fn code_actions( + #[tracing::instrument( + name= "textDocument/codeAction", + skip(self, params), + fields( + uri = %params.text_document.uri + ) + )] + async fn code_action( &self, - id: RequestId, - params: lsp_types::CodeActionParams, - ) -> anyhow::Result<()> { - let db_conn = self.db_conn.as_ref().map(|p| p.pool.clone()); - self.run_query(id, move |ide| { - let mut actions = Vec::::new(); - - if db_conn.is_none() { - return actions; - } - - let mut uri = params.text_document.uri; - normalize_uri(&mut uri); - let path = file_path(&uri); + params: CodeActionParams, + ) -> jsonrpc::Result> { + let mut uri = params.text_document.uri; + normalize_uri(&mut uri); - let doc = ide.documents.get(&path); + let path = file_path(&uri); + let range = params.range; - if doc.is_none() { - return actions; - } + let actions = self + .session + .get_available_code_actions_or_commands(path, range) + .await; - let doc = doc.unwrap(); + Ok(actions) + } - let range = doc.line_index.offset_lsp_range(params.range).unwrap(); + #[tracing::instrument( + name= "inlayHint/resolve", + skip(self, params), + fields( + uri = %params.text_document.uri + ) + )] + async fn inlay_hint(&self, params: InlayHintParams) -> jsonrpc::Result>> { + let mut uri = params.text_document.uri; + normalize_uri(&mut uri); - actions.extend(doc.statements_at_range(&range).iter().map(|stmt| { - let cmd = ExecuteStatementCommand::command_type(); - let title = format!( - "Execute '{}'", - ExecuteStatementCommand::trim_statement(stmt.text.clone(), 50) - ); - lsp_types::CodeAction { - title: title.clone(), - kind: None, - edit: None, - command: Some(lsp_types::Command { - title, - command: format!("pglsp.{}", cmd.id()), - arguments: Some(vec![serde_json::to_value(stmt.text.clone()).unwrap()]), - }), - diagnostics: None, - is_preferred: None, - disabled: None, - data: None, - } - })); + let path = file_path(&uri); + let range = params.range; - actions - }); + let hints = self.session.get_inlay_hints(path, range).await; - Ok(()) + Ok(hints) } - fn inlay_hint( + #[tracing::instrument( + name= "textDocument/completion", + skip(self, params), + fields( + uri = %params.text_document_position.text_document.uri + ) + )] + async fn completion( &self, - id: RequestId, - mut params: lsp_types::InlayHintParams, - ) -> anyhow::Result<()> { - normalize_uri(&mut params.text_document.uri); - - let c = self.client.clone(); - - self.run_query(id, move |ide| { - let path = file_path(¶ms.text_document.uri); - - let doc = ide.documents.get(&path); - - if doc.is_none() { - return Vec::new(); - } - - let doc = doc.unwrap(); + params: CompletionParams, + ) -> jsonrpc::Result> { + let mut uri = params.text_document_position.text_document.uri; + normalize_uri(&mut uri); - let range = doc.line_index.offset_lsp_range(params.range).unwrap(); + let path = file_path(&uri); + let position = params.text_document_position.position; - let schema_cache = ide.schema_cache.read().unwrap(); + let completions = self.session.get_available_completions(path, position).await; - c.send_notification::(ShowMessageParams { - typ: lsp_types::MessageType::INFO, - message: "querying inlay hints".to_string(), - }) - .unwrap(); - - doc.statements_at_range(&range) - .iter() - .flat_map(|stmt| { - ::pg_inlay_hints::inlay_hints(::pg_inlay_hints::InlayHintsParams { - ast: ide.pg_query.ast(&stmt).as_ref().map(|x| x.as_ref()), - enriched_ast: ide - .pg_query - .enriched_ast(&stmt) - .as_ref() - .map(|x| x.as_ref()), - tree: ide.tree_sitter.tree(&stmt).as_ref().map(|x| x.as_ref()), - cst: ide.pg_query.cst(&stmt).as_ref().map(|x| x.as_ref()), - schema_cache: &schema_cache, - }) - }) - .map(|hint| lsp_types::InlayHint { - position: doc.line_index.line_col_lsp(hint.offset).unwrap(), - label: match hint.content { - pg_inlay_hints::InlayHintContent::FunctionArg(arg) => { - lsp_types::InlayHintLabel::String(match arg.name { - Some(name) => format!("{} ({})", name, arg.type_name), - None => arg.type_name.clone(), - }) - } - }, - kind: match hint.content { - pg_inlay_hints::InlayHintContent::FunctionArg(_) => { - Some(lsp_types::InlayHintKind::PARAMETER) - } - }, - text_edits: None, - tooltip: None, - padding_left: None, - padding_right: None, - data: None, - }) - .collect() - }); - - Ok(()) + Ok(completions.map(|c| CompletionResponse::List(c))) } - fn completion( - &self, - id: RequestId, - mut params: lsp_types::CompletionParams, - ) -> anyhow::Result<()> { - normalize_uri(&mut params.text_document_position.text_document.uri); - - self.run_query(id, move |ide| { - let path = file_path(¶ms.text_document_position.text_document.uri); - - let doc = ide.documents.get(&path)?; - - let pos = doc - .line_index - .offset_lsp(params.text_document_position.position) - .unwrap(); - - let (range, stmt) = doc.statement_at_offset_with_range(&pos)?; - - let schema = ide.schema_cache.read().unwrap(); - - Some(CompletionList { - is_incomplete: false, - items: pg_completions::complete(&CompletionParams { - position: pos - range.start() - TextSize::from(1), - text: stmt.text.as_str(), - tree: ide.tree_sitter.tree(&stmt).as_ref().map(|x| x.as_ref()), - schema: &schema, - }) - .items - .iter() - .map(|i| lsp_types::CompletionItem { - // TODO: add more data - label: i.data.label().to_string(), - label_details: None, - kind: Some(lsp_types::CompletionItemKind::CLASS), - detail: None, - documentation: None, - deprecated: None, - preselect: None, - sort_text: None, - filter_text: None, - insert_text: None, - insert_text_format: None, - insert_text_mode: None, - text_edit: None, - additional_text_edits: None, - commit_characters: None, - data: None, - tags: None, - command: None, - }) - .collect(), - }) - }); + #[tracing::instrument( + name= "textDocument/hover", + skip(self, params), + fields( + uri = %params.text_document_position_params.text_document.uri + ) + )] + async fn hover(&self, params: HoverParams) -> jsonrpc::Result> { + let mut uri = params.text_document_position_params.text_document.uri; + normalize_uri(&mut uri); - Ok(()) - } + let path = file_path(&uri); + let position = params.text_document_position_params.position; - fn hover(&self, id: RequestId, mut params: lsp_types::HoverParams) -> anyhow::Result<()> { - normalize_uri(&mut params.text_document_position_params.text_document.uri); - - self.run_query(id, move |ide| { - let path = file_path(¶ms.text_document_position_params.text_document.uri); - let doc = ide.documents.get(&path)?; - - let pos = doc - .line_index - .offset_lsp(params.text_document_position_params.position) - .unwrap(); - - let (range, stmt) = doc.statement_at_offset_with_range(&pos)?; - - ::pg_hover::hover(HoverParams { - position: pos - range.start(), - source: stmt.text.as_str(), - enriched_ast: ide - .pg_query - .enriched_ast(&stmt) - .as_ref() - .map(|x| x.as_ref()), - tree: ide.tree_sitter.tree(&stmt).as_ref().map(|x| x.as_ref()), - schema_cache: ide.schema_cache.read().unwrap().clone(), - }) - .map(|hover| lsp_types::Hover { - contents: lsp_types::HoverContents::Scalar(lsp_types::MarkedString::String( - hover.content, - )), - range: Some(doc.line_index.line_col_lsp_range(range).unwrap()), - }) - }); + let hover_diagnostics = self + .session + .get_available_hover_diagnostics(path, position) + .await; - Ok(()) + Ok(hover_diagnostics) } - fn execute_command(&self, id: RequestId, params: ExecuteCommandParams) -> anyhow::Result<()> { + #[tracing::instrument(name = "workspace/executeCommand", skip(self, params))] + async fn execute_command( + &self, + params: ExecuteCommandParams, + ) -> jsonrpc::Result> { match CommandType::from_id(params.command.replace("pglsp.", "").as_str()) { Some(CommandType::ExecuteStatement) => { - let stmt = self.parse_command_params::(params.arguments)?; - - let command = ExecuteStatementCommand::new(stmt); - - let conn = self.db_conn.as_ref().map(|p| p.pool.clone()); - - let client = self.client.clone(); - - self.run_fallible(id, move || { - // todo return the rows and do something with them - // maybe store them and add the table to the hover output? - let res = async_std::task::block_on(command.run(conn))?; - - // todo if its a ddl statement, recompute schema cache + if params.arguments.is_empty() { + return jsonrpc::Result::Err(jsonrpc::Error::invalid_request()); + } - client - .send_notification::(ShowMessageParams { - typ: lsp_types::MessageType::INFO, - message: format!("Success! Affected rows: {}", res.rows_affected()), - }) - .unwrap(); + let params = params.arguments.into_iter().next().unwrap(); + let stmt = serde_json::from_value(params) + .map_err(|_| jsonrpc::Error::invalid_request())?; - Ok(()) - }); + match self.session.run_stmt(stmt).await { + Ok(rows_affected) => { + self.client + .send_notification::(ShowMessageParams { + typ: MessageType::INFO, + message: format!("Success! Affected rows: {}", rows_affected), + }) + .await; + } + Err(why) => { + self.client + .send_notification::(ShowMessageParams { + typ: MessageType::ERROR, + message: format!("Error! Statement exectuion failed: {}", why), + }) + .await; + } + }; } None => { self.client - .send_error( - id, - ErrorCode::InvalidParams, + .show_message( + MessageType::ERROR, format!("Unknown command: {}", params.command), ) - .unwrap(); + .await; } }; - Ok(()) - } - - fn run_fallible(&self, id: RequestId, query: Q) - where - R: Serialize, - Q: FnOnce() -> anyhow::Result + Send + 'static, - { - let client = self.client.clone(); - self.pool.execute(move || match query() { - Ok(result) => { - let response = lsp_server::Response::new_ok(id, result); - client.send_response(response).unwrap(); - } - Err(why) => { - client - .send_error(id, ErrorCode::InternalError, why.to_string()) - .unwrap(); - } - }); - } - - fn parse_command_params( - &self, - params: Vec, - ) -> anyhow::Result { - if params.is_empty() { - anyhow::bail!("No argument provided!"); - } - - let value = params.into_iter().next().unwrap(); - let value = serde_json::from_value(value)?; - Ok(value) - } - - fn run_query(&self, id: RequestId, query: Q) - where - R: Serialize, - Q: FnOnce(&Workspace) -> R + Send + 'static, - { - let client = self.client.clone(); - let ide = Arc::clone(&self.ide); - - self.pool.execute(move || { - let response = lsp_server::Response::new_ok(id, query(&ide)); - client.send_response(response).unwrap(); - }); - } - - fn refresh_schema_cache(&self) { - if self.db_conn.is_none() { - return; - } - - let tx = self.internal_tx.clone(); - let conn = self.db_conn.as_ref().unwrap().pool.clone(); - let client = self.client.clone(); - - async_std::task::spawn(async move { - client - .send_notification::(ShowMessageParams { - typ: lsp_types::MessageType::INFO, - message: "Refreshing schema cache...".to_string(), - }) - .unwrap(); - let schema_cache = SchemaCache::load(&conn).await; - tx.send(InternalMessage::SetSchemaCache(schema_cache)) - .unwrap(); - }); - } - - fn did_change_configuration( - &mut self, - params: DidChangeConfigurationParams, - ) -> anyhow::Result<()> { - if self.client_flags.configuration_pull { - self.pull_options(); - } else { - let options = self.client.parse_options(params.settings)?; - self.update_options(options); - } - - Ok(()) - } - - fn process_messages(&mut self) -> anyhow::Result<()> { - loop { - crossbeam_channel::select! { - recv(&self.connection.receiver) -> msg => { - match msg? { - Message::Request(request) => { - if self.connection.handle_shutdown(&request)? { - return Ok(()); - } - - if let Some(response) = dispatch::RequestDispatcher::new(request) - .on::(|id, params| self.inlay_hint(id, params))? - .on::(|id, params| self.hover(id, params))? - .on::(|id, params| self.execute_command(id, params))? - .on::(|id, params| { - self.completion(id, params) - })? - .on::(|id, params| { - self.code_actions(id, params) - })? - .default() - { - self.client.send_response(response)?; - } - } - Message::Notification(notification) => { - dispatch::NotificationDispatcher::new(notification) - .on::(|params| { - self.did_change_configuration(params) - })? - .on::(|params| self.did_close(params))? - .on::(|params| self.did_open(params))? - .on::(|params| self.did_change(params))? - .on::(|params| self.did_save(params))? - .on::(|params| self.did_close(params))? - .default(); - } - Message::Response(response) => { - self.client.recv_response(response)?; - } - }; - }, - recv(&self.internal_rx) -> msg => { - match msg? { - InternalMessage::SetSchemaCache(c) => { - self.ide.set_schema_cache(c); - self.compute_now(); - } - InternalMessage::RefreshSchemaCache => { - self.refresh_schema_cache(); - } - InternalMessage::PublishDiagnostics(uri) => { - self.publish_diagnostics(uri)?; - } - InternalMessage::SetOptions(options) => { - self.update_options(options); - } - }; - } - }; - } - } - - fn pull_options(&mut self) { - if !self.client_flags.configuration_pull { - return; - } - - let params = ConfigurationParams { - items: vec![ConfigurationItem { - section: Some("postgres_lsp".to_string()), - scope_uri: None, - }], - }; - - let client = self.client.clone(); - let sender = self.internal_tx.clone(); - self.pool.execute(move || { - match client.send_request::(params) { - Ok(mut json) => { - let options = client - .parse_options(json.pop().expect("invalid configuration request")) - .unwrap(); - - sender.send(InternalMessage::SetOptions(options)).unwrap(); - } - Err(_why) => { - // log::error!("Retrieving configuration failed: {}", why); - } - }; - }); - } - - fn register_configuration(&mut self) { - if self.client_flags.configuration_push { - let registration = Registration { - id: "pull-config".to_string(), - method: DidChangeConfiguration::METHOD.to_string(), - register_options: None, - }; - - let params = RegistrationParams { - registrations: vec![registration], - }; - - let client = self.client.clone(); - self.pool.execute(move || { - if let Err(_why) = client.send_request::(params) { - // log::error!( - // "Failed to register \"{}\" notification: {}", - // DidChangeConfiguration::METHOD, - // why - // ); - } - }); - } - } - - pub fn run(mut self) -> anyhow::Result<()> { - self.register_configuration(); - self.pull_options(); - self.process_messages()?; - self.pool.join(); - Ok(()) + Ok(None) } } diff --git a/crates/pg_lsp/src/server/debouncer/buffer.rs b/crates/pg_lsp/src/server/debouncer/buffer.rs deleted file mode 100644 index 6fa0574e..00000000 --- a/crates/pg_lsp/src/server/debouncer/buffer.rs +++ /dev/null @@ -1,92 +0,0 @@ -use std::collections::VecDeque; -use std::time::{Duration, Instant}; - -#[derive(Debug)] -struct Event { - item: T, - release_at: Instant, -} - -/// Current state of the debouncing buffer returned from [Get::get()]: -/// -/// - `Ready(T)` when the event is ready to be delivered after the timeout -/// (moves data out of the buffer) -/// - `Wait(Duration)` indicates how much time is left until `Ready` -/// - `Empty` means the buffer is empty -#[derive(Debug, PartialEq, Eq)] -pub enum State { - Ready(T), - Wait(Duration), - Empty, -} - -/// Common interface for getting events out of debouncing buffers. -pub trait Get: Sized { - type Data; - - /// Attemtps to get the next element out of a buffer. If an element is - /// [State::Ready] it's removed from the buffer. - fn get(&mut self) -> State; -} - -/// Debouncing buffer with a common delay for all events. Accepts events via -/// [EventBuffer::put()] which tracks the time of events and de-duplicates them -/// against the current buffer content. Subsequent call to [EventBuffer::get -/// ()] which returns the [State] of the buffer. -pub struct EventBuffer { - delay: Duration, - events: VecDeque>, -} - -impl EventBuffer { - pub fn new(delay: Duration) -> EventBuffer { - EventBuffer { - delay, - events: VecDeque::new(), - } - } - - pub fn put(&mut self, item: T) { - let time = Instant::now(); - self.events.retain(|e| e.release_at <= time); - self.events.push_back(Event { - item, - release_at: time + self.delay, - }); - } - - pub fn clear(&mut self) { - self.events.clear(); - } -} - -impl Get for EventBuffer { - type Data = T; - - fn get(&mut self) -> State { - let time = Instant::now(); - match self.events.get(0) { - None => State::Empty, - Some(e) if e.release_at > time => State::Wait(e.release_at - time), - Some(_) => State::Ready(self.events.pop_front().unwrap().item), - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use std::thread::sleep; - use std::time::Duration; - - #[test] - fn wait() { - let mut debouncer = EventBuffer::new(Duration::from_millis(20)); - debouncer.put(1); - assert!(matches!(debouncer.get(), State::Wait(_))); - sleep(Duration::from_millis(10)); - assert!(matches!(debouncer.get(), State::Wait(_))); - sleep(Duration::from_millis(10)); - assert!(matches!(debouncer.get(), State::Ready(_))); - } -} diff --git a/crates/pg_lsp/src/server/debouncer/mod.rs b/crates/pg_lsp/src/server/debouncer/mod.rs deleted file mode 100644 index c0c42899..00000000 --- a/crates/pg_lsp/src/server/debouncer/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! Data structures and helpers for *debouncing* a stream of events: removing -//! duplicate events occurring closely in time. - -pub mod buffer; -pub mod thread; - -pub use thread::EventDebouncer; diff --git a/crates/pg_lsp/src/server/debouncer/thread.rs b/crates/pg_lsp/src/server/debouncer/thread.rs deleted file mode 100644 index 3d20aaed..00000000 --- a/crates/pg_lsp/src/server/debouncer/thread.rs +++ /dev/null @@ -1,98 +0,0 @@ -#![allow(dead_code)] - -use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::{Arc, Mutex}; -use std::thread::{self, JoinHandle}; -use std::time::Duration; - -use super::buffer::{EventBuffer, Get, State}; - -struct DebouncerThread { - mutex: Arc>, - thread: JoinHandle<()>, - stopped: Arc, -} - -impl DebouncerThread { - fn new(buffer: B, mut f: F) -> Self - where - B: Get + Send + 'static, - F: FnMut(B::Data) + Send + 'static, - { - let mutex = Arc::new(Mutex::new(buffer)); - let stopped = Arc::new(AtomicBool::new(false)); - let thread = thread::spawn({ - let mutex = mutex.clone(); - let stopped = stopped.clone(); - move || { - while !stopped.load(Ordering::Relaxed) { - let state = mutex.lock().unwrap().get(); - match state { - State::Empty => thread::park(), - State::Wait(duration) => thread::sleep(duration), - State::Ready(data) => f(data), - } - } - } - }); - Self { - mutex, - thread, - stopped, - } - } - - fn stop(self) -> JoinHandle<()> { - self.stopped.store(true, Ordering::Relaxed); - self.thread - } -} - -/// Threaded debouncer wrapping [EventBuffer]. Accepts a common delay and a -/// callback function which is going to be called by a background thread with -/// debounced events. -pub struct EventDebouncer(DebouncerThread>); - -impl EventDebouncer { - pub fn new(delay: Duration, f: F) -> Self - where - F: FnMut(T) + Send + 'static, - T: Send + 'static, - { - Self(DebouncerThread::new(EventBuffer::new(delay), f)) - } - - pub fn put(&self, data: T) { - self.0.mutex.lock().unwrap().put(data); - self.0.thread.thread().unpark(); - } - - pub fn clear(&self) { - self.0.mutex.lock().unwrap().clear(); - } - - /// Signals the debouncer thread to quit and returns a - /// [std::thread::JoinHandle] which can be `.join()`ed in the consumer - /// thread. The common idiom is: `debouncer.stop().join().unwrap();` - pub fn stop(self) -> JoinHandle<()> { - self.0.stop() - } -} - -#[cfg(test)] -mod tests { - use super::*; - use std::sync::mpsc::channel; - - #[test] - fn event_debouncer() { - let (tx, rx) = channel(); - let debouncer = EventDebouncer::new(Duration::from_millis(10), move |s| { - tx.send(s).unwrap(); - }); - debouncer.put(String::from("Test1")); - debouncer.put(String::from("Test2")); - thread::sleep(Duration::from_millis(20)); - assert!(rx.try_iter().eq([String::from("Test2")])); - } -} diff --git a/crates/pg_lsp/src/server/dispatch.rs b/crates/pg_lsp/src/server/dispatch.rs deleted file mode 100644 index d8c3dc7f..00000000 --- a/crates/pg_lsp/src/server/dispatch.rs +++ /dev/null @@ -1,86 +0,0 @@ -use anyhow::Result; -use lsp_server::{ErrorCode, Notification, Request, RequestId, Response}; -use serde::de::DeserializeOwned; - -pub struct NotificationDispatcher { - not: Option, -} - -impl NotificationDispatcher { - pub fn new(not: Notification) -> Self { - Self { not: Some(not) } - } - - pub fn on(mut self, handler: F) -> Result - where - N: lsp_types::notification::Notification, - N::Params: DeserializeOwned, - F: FnOnce(N::Params) -> Result<()>, - { - if let Some(not) = self.not { - match not.extract::(N::METHOD) { - Ok(params) => { - handler(params)?; - self.not = None; - } - Err(lsp_server::ExtractError::MethodMismatch(not)) => { - self.not = Some(not); - } - Err(lsp_server::ExtractError::JsonError { .. }) => { - self.not = None; - } - }; - } - Ok(self) - } - - pub fn default(self) { - if let Some(_not) = &self.not { - // log::warn!("Unknown notification: {}", not.method); - } - } -} - -pub struct RequestDispatcher { - req: Option, -} - -impl RequestDispatcher { - pub fn new(req: Request) -> Self { - Self { req: Some(req) } - } - - pub fn on(mut self, handler: F) -> Result - where - R: lsp_types::request::Request, - R::Params: DeserializeOwned, - F: FnOnce(RequestId, R::Params) -> Result<()>, - { - if let Some(req) = self.req { - match req.extract::(R::METHOD) { - Ok((id, params)) => { - handler(id, params)?; - self.req = None; - } - Err(lsp_server::ExtractError::MethodMismatch(req)) => { - self.req = Some(req); - } - Err(lsp_server::ExtractError::JsonError { .. }) => { - self.req = None; - } - } - } - Ok(self) - } - - pub fn default(self) -> Option { - self.req.map(|req| { - // log::warn!("Unknown request: {}", req.method); - Response::new_err( - req.id, - ErrorCode::MethodNotFound as i32, - "method not found".to_string(), - ) - }) - } -} diff --git a/crates/pg_lsp/src/server/options.rs b/crates/pg_lsp/src/server/options.rs deleted file mode 100644 index a9d89c7e..00000000 --- a/crates/pg_lsp/src/server/options.rs +++ /dev/null @@ -1,8 +0,0 @@ -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -#[serde(default)] -pub struct Options { - pub db_connection_string: Option, -} diff --git a/crates/pg_lsp/src/session.rs b/crates/pg_lsp/src/session.rs new file mode 100644 index 00000000..9d7ef641 --- /dev/null +++ b/crates/pg_lsp/src/session.rs @@ -0,0 +1,307 @@ +use std::{collections::HashSet, sync::Arc}; + +use pg_base_db::{Change, DocumentChange}; +use pg_commands::{Command, ExecuteStatementCommand}; +use pg_completions::CompletionParams; +use pg_diagnostics::Diagnostic; +use pg_fs::PgLspPath; +use pg_hover::HoverParams; +use pg_workspace::Workspace; +use text_size::TextSize; +use tokio::sync::RwLock; +use tower_lsp::lsp_types::{ + CodeActionOrCommand, CompletionItem, CompletionItemKind, CompletionList, Hover, HoverContents, + InlayHint, InlayHintKind, InlayHintLabel, MarkedString, Position, Range, +}; + +use crate::{db_connection::DbConnection, utils::line_index_ext::LineIndexExt}; + +pub struct Session { + db: RwLock>, + ide: Arc>, +} + +impl Session { + pub fn new() -> Self { + Self { + db: RwLock::new(None), + ide: Arc::new(RwLock::new(Workspace::new())), + } + } + + #[tracing::instrument(name = "Shutting down Session", skip(self))] + pub async fn shutdown(&self) { + let mut db = self.db.write().await; + let db = db.take(); + + if db.is_some() { + db.unwrap().close().await; + } + } + + /// `update_db_connection` will update `Self`'s database connection. + /// If the passed-in connection string is the same that we're already connected to, it's a noop. + /// Otherwise, it'll first open a new connection, replace `Self`'s connection, and then close + /// the old one. + pub async fn change_db(&self, connection_string: String) -> anyhow::Result<()> { + if self + .db + .read() + .await + .as_ref() + // if the connection is already connected to the same database, do nothing + .is_some_and(|c| c.connected_to(&connection_string)) + { + return Ok(()); + } + + let new_db = DbConnection::new(connection_string, Arc::clone(&self.ide)).await?; + + let mut current_db = self.db.write().await; + let old_db = current_db.replace(new_db); + drop(current_db); + + if old_db.is_some() { + let old_db = old_db.unwrap(); + old_db.close().await; + } + + Ok(()) + } + + /// Runs the passed-in statement against the underlying database. + pub async fn run_stmt(&self, stmt: String) -> anyhow::Result { + let db = self.db.read().await; + let pool = db.as_ref().map(|d| d.get_pool()); + + let cmd = ExecuteStatementCommand::new(stmt); + + match cmd.run(pool).await { + Err(e) => Err(e), + Ok(res) => Ok(res.rows_affected()), + } + } + + pub async fn on_file_closed(&self, path: PgLspPath) { + let ide = self.ide.read().await; + ide.remove_document(path); + } + + pub async fn get_diagnostics(&self, path: PgLspPath) -> Vec<(Diagnostic, Range)> { + let ide = self.ide.read().await; + + // make sure there are documents at the provided path before + // trying to collect diagnostics. + let doc = ide.documents.get(&path); + if doc.is_none() { + tracing::info!("Doc not found, path: {:?}", &path); + return vec![]; + } + + ide.diagnostics(&path) + .into_iter() + .map(|d| { + let range = doc + .as_ref() + .unwrap() + .line_index + .line_col_lsp_range(d.range) + .unwrap(); + (d, range) + }) + .collect() + } + + pub async fn apply_doc_changes( + &self, + path: PgLspPath, + version: i32, + text: String, + ) -> HashSet { + { + let ide = self.ide.read().await; + + ide.apply_change( + path, + DocumentChange::new(version, vec![Change { range: None, text }]), + ); + } + + self.recompute_and_get_changed_files().await + } + + pub async fn recompute_and_get_changed_files(&self) -> HashSet { + let ide = self.ide.read().await; + + let db = self.db.read().await; + let pool = db.as_ref().map(|d| d.get_pool()); + + let changed_files = ide.compute(pool); + + changed_files.into_iter().map(|p| p.document_url).collect() + } + + pub async fn get_available_code_actions_or_commands( + &self, + path: PgLspPath, + range: Range, + ) -> Option> { + let ide = self.ide.read().await; + let doc = ide.documents.get(&path)?; + + let range = doc.line_index.offset_lsp_range(range).unwrap(); + + // for now, we only provide `ExcecuteStatementCommand`s. + let actions = doc + .statements_at_range(&range) + .into_iter() + .map(|stmt| { + let cmd = ExecuteStatementCommand::command_type(); + let title = format!( + "Execute '{}'", + ExecuteStatementCommand::trim_statement(stmt.text.clone(), 50) + ); + CodeActionOrCommand::Command(tower_lsp::lsp_types::Command { + title, + command: format!("pglsp.{}", cmd.id()), + arguments: Some(vec![serde_json::to_value(stmt.text.clone()).unwrap()]), + }) + }) + .collect(); + + Some(actions) + } + + pub async fn get_inlay_hints(&self, path: PgLspPath, range: Range) -> Option> { + let ide = self.ide.read().await; + let doc = ide.documents.get(&path)?; + + let range = doc.line_index.offset_lsp_range(range)?; + + let schema_cache = ide.schema_cache.read().expect("Unable to get Schema Cache"); + + let hints = doc + .statements_at_range(&range) + .into_iter() + .flat_map(|stmt| { + ::pg_inlay_hints::inlay_hints(::pg_inlay_hints::InlayHintsParams { + ast: ide.pg_query.ast(&stmt).as_ref().map(|x| x.as_ref()), + enriched_ast: ide + .pg_query + .enriched_ast(&stmt) + .as_ref() + .map(|x| x.as_ref()), + tree: ide.tree_sitter.tree(&stmt).as_ref().map(|x| x.as_ref()), + cst: ide.pg_query.cst(&stmt).as_ref().map(|x| x.as_ref()), + schema_cache: &schema_cache, + }) + }) + .map(|hint| InlayHint { + position: doc.line_index.line_col_lsp(hint.offset).unwrap(), + label: match hint.content { + pg_inlay_hints::InlayHintContent::FunctionArg(arg) => { + InlayHintLabel::String(match arg.name { + Some(name) => format!("{} ({})", name, arg.type_name), + None => arg.type_name.clone(), + }) + } + }, + kind: match hint.content { + pg_inlay_hints::InlayHintContent::FunctionArg(_) => { + Some(InlayHintKind::PARAMETER) + } + }, + text_edits: None, + tooltip: None, + padding_left: None, + padding_right: None, + data: None, + }) + .collect(); + + Some(hints) + } + + pub async fn get_available_completions( + &self, + path: PgLspPath, + position: Position, + ) -> Option { + let ide = self.ide.read().await; + + let doc = ide.documents.get(&path)?; + let offset = doc.line_index.offset_lsp(position)?; + let (range, stmt) = doc.statement_at_offset_with_range(&offset)?; + + let schema_cache = ide.schema_cache.read().expect("No Schema Cache"); + + let completion_items = pg_completions::complete(&CompletionParams { + position: offset - range.start() - TextSize::from(1), + text: stmt.text.as_str(), + tree: ide.tree_sitter.tree(&stmt).as_ref().map(|x| x.as_ref()), + schema: &schema_cache, + }) + .items + .into_iter() + .map(|i| CompletionItem { + // TODO: add more data + label: i.data.label().to_string(), + label_details: None, + kind: Some(CompletionItemKind::CLASS), + detail: None, + documentation: None, + deprecated: None, + preselect: None, + sort_text: None, + filter_text: None, + insert_text: None, + insert_text_format: None, + insert_text_mode: None, + text_edit: None, + additional_text_edits: None, + commit_characters: None, + data: None, + tags: None, + command: None, + }) + .collect(); + + Some(CompletionList { + is_incomplete: false, + items: completion_items, + }) + } + + pub async fn get_available_hover_diagnostics( + &self, + path: PgLspPath, + position: Position, + ) -> Option { + let ide = self.ide.read().await; + let doc = ide.documents.get(&path)?; + + let offset = doc.line_index.offset_lsp(position)?; + + let (range, stmt) = doc.statement_at_offset_with_range(&offset)?; + let range_start = range.start(); + let hover_range = doc.line_index.line_col_lsp_range(range); + + let schema_cache = ide.schema_cache.read().expect("No Schema Cache"); + + ::pg_hover::hover(HoverParams { + position: offset - range_start, + source: stmt.text.as_str(), + enriched_ast: ide + .pg_query + .enriched_ast(&stmt) + .as_ref() + .map(|x| x.as_ref()), + tree: ide.tree_sitter.tree(&stmt).as_ref().map(|x| x.as_ref()), + schema_cache: schema_cache.clone(), + }) + .map(|hover| Hover { + contents: HoverContents::Scalar(MarkedString::String(hover.content)), + range: hover_range, + }) + } +} diff --git a/crates/pg_lsp/src/utils.rs b/crates/pg_lsp/src/utils.rs index ebe4417b..bfbd57d1 100644 --- a/crates/pg_lsp/src/utils.rs +++ b/crates/pg_lsp/src/utils.rs @@ -1,11 +1,10 @@ -pub mod from_proto; pub mod line_index_ext; pub mod to_proto; use std::path::PathBuf; -use lsp_types; use pg_fs::PgLspPath; +use tower_lsp::lsp_types; /// Convert a `lsp_types::Url` to a `PgLspPath`. pub(crate) fn file_path(url: &lsp_types::Url) -> PgLspPath { diff --git a/crates/pg_lsp/src/utils/from_proto.rs b/crates/pg_lsp/src/utils/from_proto.rs deleted file mode 100644 index 47708be7..00000000 --- a/crates/pg_lsp/src/utils/from_proto.rs +++ /dev/null @@ -1,39 +0,0 @@ -use crate::client::client_flags::ClientFlags; - -use super::line_index_ext::LineIndexExt; -use pg_base_db::{Change, Document}; - -pub fn content_changes( - document: &Document, - changes: Vec, -) -> Vec { - changes - .iter() - .map(|change| Change { - range: change - .range - .map(|range| document.line_index.offset_lsp_range(range).unwrap()), - text: change.text.clone(), - }) - .collect() -} - -pub fn client_flags(capabilities: lsp_types::ClientCapabilities) -> ClientFlags { - let configuration_pull = capabilities - .workspace - .as_ref() - .and_then(|cap| cap.configuration) - .unwrap_or(false); - - let configuration_push = capabilities - .workspace - .as_ref() - .and_then(|cap| cap.did_change_configuration) - .and_then(|cap| cap.dynamic_registration) - .unwrap_or(false); - - ClientFlags { - configuration_pull, - configuration_push, - } -} diff --git a/crates/pg_lsp/src/utils/line_index_ext.rs b/crates/pg_lsp/src/utils/line_index_ext.rs index c3e740e7..de9aed9a 100644 --- a/crates/pg_lsp/src/utils/line_index_ext.rs +++ b/crates/pg_lsp/src/utils/line_index_ext.rs @@ -1,6 +1,6 @@ use line_index::{LineCol, LineColUtf16, LineIndex}; -use lsp_types::{Position, Range}; use text_size::{TextRange, TextSize}; +use tower_lsp::lsp_types::{Position, Range}; pub trait LineIndexExt { fn offset_lsp(&self, line_col: Position) -> Option; diff --git a/crates/pg_lsp/src/utils/to_proto.rs b/crates/pg_lsp/src/utils/to_proto.rs index f06f80f8..6f076ad7 100644 --- a/crates/pg_lsp/src/utils/to_proto.rs +++ b/crates/pg_lsp/src/utils/to_proto.rs @@ -1,9 +1,7 @@ -use pg_base_db::Document; use pg_diagnostics::Diagnostic; +use tower_lsp::lsp_types; -use super::line_index_ext::LineIndexExt; - -pub fn diagnostic(document: &Document, diagnostic: &Diagnostic) -> lsp_types::Diagnostic { +pub fn diagnostic(diagnostic: Diagnostic, range: lsp_types::Range) -> lsp_types::Diagnostic { let severity = match diagnostic.severity { pg_diagnostics::Severity::Error => lsp_types::DiagnosticSeverity::ERROR, pg_diagnostics::Severity::Warning => lsp_types::DiagnosticSeverity::WARNING, @@ -12,14 +10,9 @@ pub fn diagnostic(document: &Document, diagnostic: &Diagnostic) -> lsp_types::Di pg_diagnostics::Severity::Fatal => lsp_types::DiagnosticSeverity::ERROR, }; - let range = document - .line_index - .line_col_lsp_range(diagnostic.range) - .unwrap(); - lsp_types::Diagnostic { severity: Some(severity), - source: Some(diagnostic.source.clone()), - ..lsp_types::Diagnostic::new_simple(range, diagnostic.message.clone()) + source: Some(diagnostic.source), + ..lsp_types::Diagnostic::new_simple(range, diagnostic.message) } } diff --git a/crates/pg_schema_cache/src/lib.rs b/crates/pg_schema_cache/src/lib.rs index aed612c6..82454fc3 100644 --- a/crates/pg_schema_cache/src/lib.rs +++ b/crates/pg_schema_cache/src/lib.rs @@ -4,11 +4,11 @@ #![feature(future_join)] mod functions; -mod versions; mod schema_cache; mod schemas; mod tables; mod types; +mod versions; use sqlx::postgres::PgPool; diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 1c0e599b..3950df5e 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -1,20 +1,23 @@ -import { ExtensionContext } from 'vscode'; +import type { ExtensionContext } from 'vscode'; import { - Executable, + type Executable, LanguageClient, - LanguageClientOptions, - ServerOptions + type LanguageClientOptions, + type ServerOptions } from 'vscode-languageclient/node'; let client: LanguageClient; -export function activate(context: ExtensionContext) { +export function activate(_context: ExtensionContext) { // If the extension is launched in debug mode then the debug server options are used // Otherwise the run options are used const run: Executable = { command: 'pglsp' }; + + // const outputChannel = window.createOutputChannel('postgres_lsp'); + const serverOptions: ServerOptions = { run, debug: run @@ -23,24 +26,18 @@ export function activate(context: ExtensionContext) { // Options to control the language client const clientOptions: LanguageClientOptions = { // Register the server for plain text documents - documentSelector: [ - { scheme: 'file', language: 'sql' } - ] + documentSelector: [{ scheme: 'file', language: 'sql' }] }; // Create the language client and start the client. - client = new LanguageClient( - 'postgres_lsp', - 'Postgres LSP', - serverOptions, - clientOptions - ); + client = new LanguageClient('postgres_lsp', 'Postgres LSP', serverOptions, clientOptions); // Start the client. This will also launch the server - client.start(); + void client.start(); } export function deactivate(): Thenable | undefined { + console.log('Deactivating client...'); if (!client) { return undefined; } diff --git a/editors/code/tsconfig.json b/editors/code/tsconfig.json index ee353c28..125021ee 100644 --- a/editors/code/tsconfig.json +++ b/editors/code/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tsconfig/strictest/tsconfig.json", "compilerOptions": { "esModuleInterop": false, - "module": "commonjs", + "module": "Node16", "moduleResolution": "node16", "target": "es2021", "outDir": "out", diff --git a/test.sql b/test.sql index e8405740..33d5f65c 100644 --- a/test.sql +++ b/test.sql @@ -1,7 +1,7 @@ select id, name, test1231234123, unknown from co; -select 14433313331333 +select 1123123; alter table test drop column id; -select lower('test'); +select lower(); diff --git a/xtask/src/install.rs b/xtask/src/install.rs index 85c03e13..c149bd5a 100644 --- a/xtask/src/install.rs +++ b/xtask/src/install.rs @@ -137,10 +137,7 @@ fn install_client(sh: &Shell, client_opt: ClientOpt) -> anyhow::Result<()> { } fn install_server(sh: &Shell) -> anyhow::Result<()> { - let cmd = cmd!( - sh, - "cargo install --path crates/pg_lsp --locked --force" - ); + let cmd = cmd!(sh, "cargo install --path crates/pg_lsp --locked --force"); cmd.run()?; Ok(()) }