diff --git a/Cargo.lock b/Cargo.lock index c06f6fc19d2..19f5ad9e0b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,15 +28,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anstream" version = "0.6.13" @@ -85,12 +76,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "anyhow" -version = "1.0.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" - [[package]] name = "arrayref" version = "0.3.7" @@ -103,12 +88,6 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "ascii" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" - [[package]] name = "atty" version = "0.2.14" @@ -182,12 +161,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bumpalo" -version = "3.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" - [[package]] name = "bytecheck" version = "0.6.11" @@ -210,12 +183,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "bytes" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - [[package]] name = "camino" version = "1.1.6" @@ -224,18 +191,9 @@ checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" +checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" [[package]] name = "cfg-if" @@ -243,32 +201,11 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chunked_transfer" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cca491388666e04d7248af3f60f0c40cfb0991c72205595d7c396e3510207d1a" - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim 0.8.0", - "textwrap", - "unicode-width", - "vec_map", -] - [[package]] name = "clap" -version = "4.5.1" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -276,23 +213,23 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.1" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.0", + "strsim", ] [[package]] name = "clap_derive" -version = "4.5.0" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.51", @@ -321,16 +258,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "combine" -version = "4.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "console" version = "0.15.7" @@ -369,22 +296,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - [[package]] name = "cpufeatures" version = "0.2.9" @@ -424,12 +335,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "difference" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" - [[package]] name = "digest" version = "0.10.7" @@ -440,33 +345,13 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "dirs" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "duplicate" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de78e66ac9061e030587b2a2e75cc88f22304913c907b11307bca737141230cb" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro-error", ] @@ -506,14 +391,14 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "filetime" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", - "windows-sys 0.48.0", + "redox_syscall", + "windows-sys 0.52.0", ] [[package]] @@ -574,12 +459,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - [[package]] name = "globset" version = "0.4.12" @@ -614,6 +493,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -638,21 +523,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "html-escape" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476" -dependencies = [ - "utf8-width", -] - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - [[package]] name = "idna" version = "0.4.0" @@ -675,9 +545,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.3" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -686,9 +556,9 @@ dependencies = [ [[package]] name = "indoc" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "insta" @@ -732,37 +602,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" -[[package]] -name = "jni" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" -dependencies = [ - "cesu8", - "cfg-if", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", - "windows-sys 0.45.0", -] - -[[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - -[[package]] -name = "js-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" -dependencies = [ - "wasm-bindgen", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -775,16 +614,6 @@ version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - [[package]] name = "linked-hash-map" version = "0.5.6" @@ -799,9 +628,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lsp-types" @@ -816,20 +645,11 @@ dependencies = [ "url", ] -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memoffset" @@ -849,12 +669,6 @@ dependencies = [ "adler", ] -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -865,15 +679,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", -] - [[package]] name = "once_cell" version = "1.19.0" @@ -1109,51 +914,25 @@ dependencies = [ "getrandom", ] -[[package]] -name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall 0.2.16", - "thiserror", -] - [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.8.2", + "regex-syntax", ] [[package]] @@ -1164,20 +943,14 @@ checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rend" @@ -1216,12 +989,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustix" version = "0.38.31" @@ -1247,27 +1014,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "seahash" version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "semver" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" - [[package]] name = "serde" version = "1.0.197" @@ -1290,11 +1042,10 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ - "indexmap 2.2.3", "itoa", "ryu", "serde", @@ -1349,12 +1100,6 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" -[[package]] -name = "smallbitvec" -version = "2.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ce4f9dc4a41b4c3476cc925f1efb11b66df373a8fde5d4b8915fa91b5d995e" - [[package]] name = "smallvec" version = "1.13.1" @@ -1382,12 +1127,6 @@ dependencies = [ "syn 2.0.51", ] -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - [[package]] name = "strsim" version = "0.11.0" @@ -1409,7 +1148,7 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a3417fc93d76740d974a01654a09777cb500428cc874ca9f45edfe0c4d4cd18" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", @@ -1465,15 +1204,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - [[package]] name = "thiserror" version = "1.0.57" @@ -1504,18 +1234,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tiny_http" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389915df6413a2e74fb181895f933386023c71110878cd0825588928e64cdc82" -dependencies = [ - "ascii", - "chunked_transfer", - "httpdate", - "log", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -1531,15 +1249,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "tracing" version = "0.1.40" @@ -1599,120 +1308,19 @@ dependencies = [ [[package]] name = "tree-sitter" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e747b1f9b7b931ed39a548c1fae149101497de3c1fc8d9e18c62c1a66c683d3d" +version = "0.22.4" +source = "git+https://github.com/tree-sitter/tree-sitter.git?rev=a7a47d561d4e64eaf226f93c4d68076afa67fdda#a7a47d561d4e64eaf226f93c4d68076afa67fdda" dependencies = [ "cc", "regex", ] -[[package]] -name = "tree-sitter-cli" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae7e9d844d4d38e511a7b93fe8ced79f2a364c32fdea10d04546f1c8317d5a0c" -dependencies = [ - "ansi_term", - "anyhow", - "atty", - "clap 2.34.0", - "difference", - "dirs", - "glob", - "html-escape", - "indexmap 1.9.3", - "lazy_static", - "log", - "regex", - "regex-syntax 0.6.29", - "rustc-hash", - "semver", - "serde", - "serde_json", - "smallbitvec", - "tiny_http", - "toml", - "tree-sitter", - "tree-sitter-config", - "tree-sitter-highlight", - "tree-sitter-loader", - "tree-sitter-tags", - "walkdir", - "webbrowser", - "which", -] - -[[package]] -name = "tree-sitter-config" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fec4cb27f052ead2246631b332dba0cb6af9a54ce012badee59c4b0ded5e03" -dependencies = [ - "anyhow", - "dirs", - "serde", - "serde_json", -] - -[[package]] -name = "tree-sitter-highlight" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "042342584c5a7a0b833d9fc4e2bdab3f9868ddc6c4b339a1e01451c6720868bc" -dependencies = [ - "regex", - "thiserror", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-loader" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b17eef4833c7c139abed66d562dfa23228e97e647597baf246fd56c21bbfaf" -dependencies = [ - "anyhow", - "cc", - "dirs", - "libloading", - "once_cell", - "regex", - "serde", - "serde_json", - "tree-sitter", - "tree-sitter-highlight", - "tree-sitter-tags", -] - -[[package]] -name = "tree-sitter-tags" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb3f1376219530a37a809751ecf65aa35fd8b9c1c4ab6d4faf5f6a9eeda2c05" -dependencies = [ - "memchr", - "regex", - "thiserror", - "tree-sitter", -] - -[[package]] -name = "tree-sitter-traversal" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8a158225e4a4d8505f071340bba9edd109b23f01b70540dccb7c799868f307" -dependencies = [ - "tree-sitter", -] - [[package]] name = "tree-sitter-wing" version = "0.0.0" dependencies = [ "cc", "tree-sitter", - "tree-sitter-cli", ] [[package]] @@ -1748,12 +1356,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - [[package]] name = "unicode-xid" version = "0.2.4" @@ -1772,12 +1374,6 @@ dependencies = [ "serde", ] -[[package]] -name = "utf8-width" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5190c9442dcdaf0ddd50f37420417d219ae5261bbf5db120d0f9bab996c9cba1" - [[package]] name = "utf8parse" version = "0.2.1" @@ -1800,12 +1396,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" @@ -1818,115 +1408,12 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65dd7eed29412da847b0f78bcec0ac98588165988a8cfe41d4ea1d429f8ccfff" -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.51", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.51", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" - -[[package]] -name = "web-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webbrowser" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b2391658b02c27719fc5a0a73d6e696285138e8b12fba9d4baa70451023c71" -dependencies = [ - "core-foundation", - "home", - "jni", - "log", - "ndk-context", - "objc", - "raw-window-handle", - "url", - "web-sys", -] - -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - [[package]] name = "winapi" version = "0.3.9" @@ -2167,7 +1654,7 @@ dependencies = [ "derivative", "duplicate", "globset", - "indexmap 2.2.3", + "indexmap 2.2.6", "indoc", "insta", "itertools", @@ -2182,7 +1669,6 @@ dependencies = [ "strum", "tempfile", "tree-sitter", - "tree-sitter-traversal", "tree-sitter-wing", "uuid", "wingii", @@ -2195,7 +1681,7 @@ dependencies = [ "anstyle", "atty", "camino", - "clap 4.5.1", + "clap", "home", "lazy_static", "strum", diff --git a/apps/wing/src/commands/lsp.ts b/apps/wing/src/commands/lsp.ts index b3894b4711b..bf64d40c0fb 100644 --- a/apps/wing/src/commands/lsp.ts +++ b/apps/wing/src/commands/lsp.ts @@ -136,9 +136,14 @@ export async function lsp() { for (const rd of raw_diagnostics) { if (rd.span) { const diagnosticUri = "file://" + rd.span.file_id; + let message = rd.message; + if (rd.hints.length > 0) { + message += `\n${rd.hints.map((hint) => `hint: ${hint}`).join("\n")}`; + } + const diag = Diagnostic.create( Range.create(rd.span.start.line, rd.span.start.col, rd.span.end.line, rd.span.end.col), - `${rd.message}\n${rd.hints.map((hint) => `hint: ${hint}`).join("\n")}`, + message, undefined, undefined, undefined, diff --git a/docs/contributing/999-rfcs/2024-03-31-wing-secrets-cli.md b/docs/contributing/999-rfcs/2024-03-31-wing-secrets-cli.md new file mode 100644 index 00000000000..8f970cc7320 --- /dev/null +++ b/docs/contributing/999-rfcs/2024-03-31-wing-secrets-cli.md @@ -0,0 +1,116 @@ +--- +title: "#6105 Wing Secrets CLI" +description: Creating Wing secrets from the CLI +--- + +# Wing Secrets CLI +- **Author(s)**: @hasanaburayyan +- **Submission Date**: 2024-03-31 +- **Stage**: Draft + +Creating secrets through the Wing CLI. + +## Background + +Wing applications often require secrets to be retrieved during runtime. These secrets are stored in platform specific secret stores, such as AWS Secrets Manager for `tf-aws` or a local `.env` file for the `sim` platform. + +Secrets must be configured before the application is run, and now the Wing CLI along with Wing platforms make it easy to configure secrets. + +### Out of Scope + +In this RFC a few things are out of scope: +- Checking if the secrets exist in the platform's secret store when running `wing compile` +- Reading secret values, for now we will only focus on creating secrets + +## Platform Hook + +Since secrets creation is platform specific, platforms can now implement a new hook `configureSecrets(secrets: { [key: string]: string }): string` which will be called by the Wing CLI to configure the secrets. + +For example the `sim` platform implementation which needs to store secrets in a `.env` file, would look something like this: + +```js +public async configureSecrets(secrets: { [key: string]: string }): Promise { + let existingSecretsContent = ""; + try { + existingSecretsContent = fs.readFileSync('./.env', 'utf8'); + } catch (error) {} + + const existingSecrets = existingSecretsContent.split('\n') + .filter(line => line.trim() !== '') + .reduce((s, line) => { + const [key, value] = line.split('=', 2); + s[key] = value; + return s; + }, {} as { [key: string]: string }); + + for (const key in secrets) { + existingSecrets[key] = secrets[key]; + } + + const updatedContent = Object.entries(existingSecrets) + .map(([key, value]) => `${key}=${value}`) + .join('\n'); + + fs.writeFileSync('./.env', updatedContent); + + return "Secrets saved to .env file"; +} +``` + +## CLI Command + +Introducing a new Wing CLI command `secrets` which will be used for managing secrets in the Wing applications. + +Given the following Wing application: + +```js +bring cloud; + +let slackSigningSecret = new cloud.Secret(name: "SLACK_SIGNING_SECRET"); +let slackBotToken = new cloud.Secret(name: "SLACK_BOT_TOKEN"); +``` + +### Creating Secrets + +Running `wing secrets main.w` will result in an interactive experience where the user is prompted to enter the values for the secrets: + +```bash +wing secrets main.w + +2 secrets found in main.w + +Enter the value for SLACK_SIGNING_SECRET: ******** +Enter the value for SLACK_BOT_TOKEN: ******** + +Secrets saved to .env file +``` + +This results in a `.env` file being created with the secrets stored in it. + +### specifying the platform + +You can specify the platform using the `-t` flag, for example to configure the secrets for the `tf-aws` platform: + +```bash +wing secrets main.w -t tf-aws + +2 secrets found in main.w + +Enter the value for SLACK_SIGNING_SECRET: ******** +Enter the value for SLACK_BOT_TOKEN: ******** + +Secrets saved to AWS Secrets Manager +``` + +### Listing Secrets + +If the user prefers to ignore the interactive experience of creating secrets in favor of creating the secrets themselves, there is an option to list the secrets in the Wing application: + +```bash +wing secrets main.w --list + +2 secrets found in main.w + +- SLACK_SIGNING_SECRET +- SLACK_BOT_TOKEN +``` diff --git a/libs/tree-sitter-wing/.editorconfig b/libs/tree-sitter-wing/.editorconfig new file mode 100644 index 00000000000..d3a8b5b697f --- /dev/null +++ b/libs/tree-sitter-wing/.editorconfig @@ -0,0 +1,39 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{json,toml,yml,gyp}] +indent_style = space +indent_size = 2 + +[*.js] +indent_style = space +indent_size = 2 + +[*.rs] +indent_style = space +indent_size = 4 + +[*.{c,cc,h}] +indent_style = space +indent_size = 4 + +[*.{py,pyi}] +indent_style = space +indent_size = 4 + +[*.swift] +indent_style = space +indent_size = 4 + +[*.go] +indent_style = tab +indent_size = 8 + +[Makefile] +indent_style = tab +indent_size = 8 diff --git a/libs/tree-sitter-wing/Cargo.toml b/libs/tree-sitter-wing/Cargo.toml index 48d45c0adf4..dc898aa1e58 100644 --- a/libs/tree-sitter-wing/Cargo.toml +++ b/libs/tree-sitter-wing/Cargo.toml @@ -1,31 +1,24 @@ [package] name = "tree-sitter-wing" -description = "winglang grammar for the tree-sitter parsing library" +description = "Wing grammar for tree-sitter" version = "0.0.0" -keywords = ["incremental", "parsing", "wing"] +license = "MIT" +readme = "README.md" +keywords = ["incremental", "parsing", "tree-sitter", "wing"] categories = ["parsing", "text-editors"] -repository = "https://github.com/winglang/wing/tree/main/libs/tree-sitter-wing" +repository = "https://github.com/winglang/tree-sitter-wing" edition = "2021" -license = "MIT" +autoexamples = false build = "bindings/rust/build.rs" -include = [ - "bindings/rust/*", - "grammar.js", - "queries/*", - "src/*", -] +include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"] [lib] path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "0.20.10" - -[dev-dependencies] -tree-sitter-cli = "0.20.8" +# Waiting for https://github.com/tree-sitter/tree-sitter/pull/3293 to be released +tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter.git", rev = "a7a47d561d4e64eaf226f93c4d68076afa67fdda" } [build-dependencies] -cc = "1.0" -tree-sitter-cli = "0.20.8" -tree-sitter = "0.20.10" +cc = "1.0.87" diff --git a/libs/tree-sitter-wing/Makefile b/libs/tree-sitter-wing/Makefile new file mode 100644 index 00000000000..34378005408 --- /dev/null +++ b/libs/tree-sitter-wing/Makefile @@ -0,0 +1,112 @@ +VERSION := 0.0.0 + +LANGUAGE_NAME := tree-sitter-wing + +# repository +SRC_DIR := src + +PARSER_REPO_URL := $(shell git -C $(SRC_DIR) remote get-url origin 2>/dev/null) + +ifeq ($(PARSER_URL),) + PARSER_URL := $(subst .git,,$(PARSER_REPO_URL)) +ifeq ($(shell echo $(PARSER_URL) | grep '^[a-z][-+.0-9a-z]*://'),) + PARSER_URL := $(subst :,/,$(PARSER_URL)) + PARSER_URL := $(subst git@,https://,$(PARSER_URL)) +endif +endif + +TS ?= tree-sitter + +# ABI versioning +SONAME_MAJOR := $(word 1,$(subst ., ,$(VERSION))) +SONAME_MINOR := $(word 2,$(subst ., ,$(VERSION))) + +# install directory layout +PREFIX ?= /usr/local +INCLUDEDIR ?= $(PREFIX)/include +LIBDIR ?= $(PREFIX)/lib +PCLIBDIR ?= $(LIBDIR)/pkgconfig + +# source/object files +PARSER := $(SRC_DIR)/parser.c +EXTRAS := $(filter-out $(PARSER),$(wildcard $(SRC_DIR)/*.c)) +OBJS := $(patsubst %.c,%.o,$(PARSER) $(EXTRAS)) + +# flags +ARFLAGS ?= rcs +override CFLAGS += -I$(SRC_DIR) -std=c11 -fPIC + +# OS-specific bits +ifeq ($(OS),Windows_NT) + $(error "Windows is not supported") +else ifeq ($(shell uname),Darwin) + SOEXT = dylib + SOEXTVER_MAJOR = $(SONAME_MAJOR).dylib + SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).dylib + LINKSHARED := $(LINKSHARED)-dynamiclib -Wl, + ifneq ($(ADDITIONAL_LIBS),) + LINKSHARED := $(LINKSHARED)$(ADDITIONAL_LIBS), + endif + LINKSHARED := $(LINKSHARED)-install_name,$(LIBDIR)/lib$(LANGUAGE_NAME).$(SONAME_MAJOR).dylib,-rpath,@executable_path/../Frameworks +else + SOEXT = so + SOEXTVER_MAJOR = so.$(SONAME_MAJOR) + SOEXTVER = so.$(SONAME_MAJOR).$(SONAME_MINOR) + LINKSHARED := $(LINKSHARED)-shared -Wl, + ifneq ($(ADDITIONAL_LIBS),) + LINKSHARED := $(LINKSHARED)$(ADDITIONAL_LIBS) + endif + LINKSHARED := $(LINKSHARED)-soname,lib$(LANGUAGE_NAME).so.$(SONAME_MAJOR) +endif +ifneq ($(filter $(shell uname),FreeBSD NetBSD DragonFly),) + PCLIBDIR := $(PREFIX)/libdata/pkgconfig +endif + +all: lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) $(LANGUAGE_NAME).pc + +lib$(LANGUAGE_NAME).a: $(OBJS) + $(AR) $(ARFLAGS) $@ $^ + +lib$(LANGUAGE_NAME).$(SOEXT): $(OBJS) + $(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@ +ifneq ($(STRIP),) + $(STRIP) $@ +endif + +$(LANGUAGE_NAME).pc: bindings/c/$(LANGUAGE_NAME).pc.in + sed -e 's|@URL@|$(PARSER_URL)|' \ + -e 's|@VERSION@|$(VERSION)|' \ + -e 's|@LIBDIR@|$(LIBDIR)|' \ + -e 's|@INCLUDEDIR@|$(INCLUDEDIR)|' \ + -e 's|@REQUIRES@|$(REQUIRES)|' \ + -e 's|@ADDITIONAL_LIBS@|$(ADDITIONAL_LIBS)|' \ + -e 's|=$(PREFIX)|=$${prefix}|' \ + -e 's|@PREFIX@|$(PREFIX)|' $< > $@ + +$(PARSER): $(SRC_DIR)/grammar.json + $(TS) generate --no-bindings $^ + +install: all + install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter '$(DESTDIR)$(PCLIBDIR)' '$(DESTDIR)$(LIBDIR)' + install -m644 bindings/c/$(LANGUAGE_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h + install -m644 $(LANGUAGE_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc + install -m644 lib$(LANGUAGE_NAME).a '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a + install -m755 lib$(LANGUAGE_NAME).$(SOEXT) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) + ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) + ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) + +uninstall: + $(RM) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) \ + '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h \ + '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc + +clean: + $(RM) $(OBJS) $(LANGUAGE_NAME).pc lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) + +test: + $(TS) test + +.PHONY: all install uninstall clean test diff --git a/libs/tree-sitter-wing/Package.swift b/libs/tree-sitter-wing/Package.swift new file mode 100644 index 00000000000..26b11f39028 --- /dev/null +++ b/libs/tree-sitter-wing/Package.swift @@ -0,0 +1,47 @@ +// swift-tools-version:5.3 +import PackageDescription + +let package = Package( + name: "TreeSitterWing", + products: [ + .library(name: "TreeSitterWing", targets: ["TreeSitterWing"]), + ], + dependencies: [], + targets: [ + .target(name: "TreeSitterWing", + path: ".", + exclude: [ + "Cargo.toml", + "Makefile", + "binding.gyp", + "bindings/c", + "bindings/go", + "bindings/node", + "bindings/python", + "bindings/rust", + "prebuilds", + "grammar.js", + "package.json", + "package-lock.json", + "pyproject.toml", + "setup.py", + "test", + "examples", + ".editorconfig", + ".github", + ".gitignore", + ".gitattributes", + ".gitmodules", + ], + sources: [ + "src/parser.c", + "src/scanner.c", + ], + resources: [ + .copy("queries") + ], + publicHeadersPath: "bindings/swift", + cSettings: [.headerSearchPath("src")]) + ], + cLanguageStandard: .c11 +) diff --git a/libs/tree-sitter-wing/README.md b/libs/tree-sitter-wing/README.md index 032334ea2ed..b263c5a704f 100644 --- a/libs/tree-sitter-wing/README.md +++ b/libs/tree-sitter-wing/README.md @@ -1,19 +1,9 @@ # tree-sitter-wing -TODO +A tree-sitter parser for the Wing language. -## Build +Wing is still heavily in development and this grammar/parser is experimental. It is used directly in the Wing compiler and is not considered a public API. It is available here for use but may have breaking changes at any time and no bindings are published or guaranteed to be work. -```sh -cargo build -``` +## Contributing -## Test - -```sh -cargo test -``` - -## License - -Licensed under the MIT license. +Issues are tracked as part of the [Wing](https://github.com/winglang/wing) repository. diff --git a/libs/tree-sitter-wing/binding.gyp b/libs/tree-sitter-wing/binding.gyp index d60fd6cc2c6..fad37c76a4a 100644 --- a/libs/tree-sitter-wing/binding.gyp +++ b/libs/tree-sitter-wing/binding.gyp @@ -2,18 +2,29 @@ "targets": [ { "target_name": "tree_sitter_wing_binding", + "dependencies": [ + " -#include "nan.h" +#include -using namespace v8; +typedef struct TSLanguage TSLanguage; -extern "C" TSLanguage * tree_sitter_wing(); +extern "C" TSLanguage *tree_sitter_wing(); -namespace { +// "tree-sitter", "language" hashed with BLAKE2 +const napi_type_tag LANGUAGE_TYPE_TAG = { + 0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16 +}; -NAN_METHOD(New) {} - -void Init(Local exports, Local module) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("Language").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Local constructor = Nan::GetFunction(tpl).ToLocalChecked(); - Local instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); - Nan::SetInternalFieldPointer(instance, 0, tree_sitter_wing()); - - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("wing").ToLocalChecked()); - Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); +Napi::Object Init(Napi::Env env, Napi::Object exports) { + exports["name"] = Napi::String::New(env, "wing"); + auto language = Napi::External::New(env, tree_sitter_wing()); + language.TypeTag(&LANGUAGE_TYPE_TAG); + exports["language"] = language; + return exports; } -NODE_MODULE(tree_sitter_wing_binding, Init) - -} // namespace +NODE_API_MODULE(tree_sitter_wing_binding, Init) diff --git a/libs/tree-sitter-wing/bindings/node/index.d.ts b/libs/tree-sitter-wing/bindings/node/index.d.ts new file mode 100644 index 00000000000..efe259eed03 --- /dev/null +++ b/libs/tree-sitter-wing/bindings/node/index.d.ts @@ -0,0 +1,28 @@ +type BaseNode = { + type: string; + named: boolean; +}; + +type ChildNode = { + multiple: boolean; + required: boolean; + types: BaseNode[]; +}; + +type NodeInfo = + | (BaseNode & { + subtypes: BaseNode[]; + }) + | (BaseNode & { + fields: { [name: string]: ChildNode }; + children: ChildNode[]; + }); + +type Language = { + name: string; + language: unknown; + nodeTypeInfo: NodeInfo[]; +}; + +declare const language: Language; +export = language; diff --git a/libs/tree-sitter-wing/bindings/node/index.js b/libs/tree-sitter-wing/bindings/node/index.js index e61b689515a..6657bcf42de 100644 --- a/libs/tree-sitter-wing/bindings/node/index.js +++ b/libs/tree-sitter-wing/bindings/node/index.js @@ -1,18 +1,6 @@ -try { - module.exports = require("../../build/Release/tree_sitter_wing_binding"); -} catch (error1) { - if (error1.code !== 'MODULE_NOT_FOUND') { - throw error1; - } - try { - module.exports = require("../../build/Debug/tree_sitter_wing_binding"); - } catch (error2) { - if (error2.code !== 'MODULE_NOT_FOUND') { - throw error2; - } - throw error1 - } -} +const root = require("path").join(__dirname, "..", ".."); + +module.exports = require("node-gyp-build")(root); try { module.exports.nodeTypeInfo = require("../../src/node-types.json"); diff --git a/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.py b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.py new file mode 100644 index 00000000000..d1756f267c9 --- /dev/null +++ b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.py @@ -0,0 +1,5 @@ +"Wing grammar for tree-sitter" + +from ._binding import language + +__all__ = ["language"] diff --git a/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.pyi b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.pyi new file mode 100644 index 00000000000..5416666fc30 --- /dev/null +++ b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/__init__.pyi @@ -0,0 +1 @@ +def language() -> int: ... diff --git a/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/binding.c b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/binding.c new file mode 100644 index 00000000000..edc7a07bbc8 --- /dev/null +++ b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/binding.c @@ -0,0 +1,27 @@ +#include + +typedef struct TSLanguage TSLanguage; + +TSLanguage *tree_sitter_wing(void); + +static PyObject* _binding_language(PyObject *self, PyObject *args) { + return PyLong_FromVoidPtr(tree_sitter_wing()); +} + +static PyMethodDef methods[] = { + {"language", _binding_language, METH_NOARGS, + "Get the tree-sitter language for this grammar."}, + {NULL, NULL, 0, NULL} +}; + +static struct PyModuleDef module = { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "_binding", + .m_doc = NULL, + .m_size = -1, + .m_methods = methods +}; + +PyMODINIT_FUNC PyInit__binding(void) { + return PyModule_Create(&module); +} diff --git a/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/py.typed b/libs/tree-sitter-wing/bindings/python/tree_sitter_wing/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libs/tree-sitter-wing/bindings/rust/build.rs b/libs/tree-sitter-wing/bindings/rust/build.rs index ed5313fc8a1..3884b3f9d73 100644 --- a/libs/tree-sitter-wing/bindings/rust/build.rs +++ b/libs/tree-sitter-wing/bindings/rust/build.rs @@ -1,20 +1,20 @@ -use std::path::PathBuf; -use tree_sitter_cli::generate::generate_parser_in_directory; - fn main() { let src_dir = std::path::Path::new("src"); - generate_parser_in_directory(&PathBuf::from("."), None, tree_sitter::LANGUAGE_VERSION, false, None) - .expect("Generating parser"); - let mut c_config = cc::Build::new(); - c_config - .include(src_dir) - .flag("-Wno-unused-parameter") - .flag("-Wno-unused-but-set-variable") - .flag("-Wno-trigraphs") - .file(&src_dir.join("parser.c")) - .file(&src_dir.join("scanner.c")); + c_config.std("c11").include(src_dir).flag("-Wno-unused-parameter"); + + #[cfg(target_env = "msvc")] + c_config.flag("-utf-8"); + + let parser_path = src_dir.join("parser.c"); + c_config.file(&parser_path); + println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap()); + + // External scanner + let scanner_path = src_dir.join("scanner.c"); + c_config.file(&scanner_path); + println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); if cfg!(target_arch = "wasm32") { // This parser is used in a WASI context, so it needs to be compiled with @@ -28,8 +28,5 @@ fn main() { ); } - c_config.compile("parser"); - - println!("cargo:rerun-if-changed=grammar.js"); - println!("cargo:rerun-if-changed=src/scanner.c"); + c_config.compile("tree-sitter-wing"); } diff --git a/libs/tree-sitter-wing/bindings/rust/lib.rs b/libs/tree-sitter-wing/bindings/rust/lib.rs index f82ee198f44..1e1fa5a6fb2 100644 --- a/libs/tree-sitter-wing/bindings/rust/lib.rs +++ b/libs/tree-sitter-wing/bindings/rust/lib.rs @@ -1,13 +1,15 @@ -//! This crate provides wing language support for the [tree-sitter][] parsing library. +//! This crate provides Wing language support for the [tree-sitter][] parsing library. //! //! Typically, you will use the [language][language func] function to add this language to a //! tree-sitter [Parser][], and then use the parser to parse some code: //! //! ``` -//! let code = ""; +//! let code = r#" +//! "#; //! let mut parser = tree_sitter::Parser::new(); -//! parser.set_language(tree_sitter_wing::language()).expect("Error loading wing grammar"); +//! parser.set_language(&tree_sitter_wing::language()).expect("Error loading Wing grammar"); //! let tree = parser.parse(code, None).unwrap(); +//! assert!(!tree.root_node().has_error()); //! ``` //! //! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html @@ -18,14 +20,14 @@ use tree_sitter::Language; extern "C" { - fn tree_sitter_wing() -> Language; + fn tree_sitter_wing() -> Language; } /// Get the tree-sitter [Language][] for this grammar. /// /// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html pub fn language() -> Language { - unsafe { tree_sitter_wing() } + unsafe { tree_sitter_wing() } } /// The content of the [`node-types.json`][] file for this grammar. @@ -35,7 +37,18 @@ pub const NODE_TYPES: &str = include_str!("../../src/node-types.json"); // Uncomment these to include any queries that this grammar contains -pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm"); -// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm"); -pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm"); -// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm"); +// pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm"); +// pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm"); +// pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm"); +// pub const TAGS_QUERY: &str = include_str!("../../queries/tags.scm"); + +#[cfg(test)] +mod tests { + #[test] + fn test_can_load_grammar() { + let mut parser = tree_sitter::Parser::new(); + parser + .set_language(&super::language()) + .expect("Error loading Wing grammar"); + } +} diff --git a/libs/tree-sitter-wing/bindings/swift/TreeSitterWing/wing.h b/libs/tree-sitter-wing/bindings/swift/TreeSitterWing/wing.h new file mode 100644 index 00000000000..643f4db955c --- /dev/null +++ b/libs/tree-sitter-wing/bindings/swift/TreeSitterWing/wing.h @@ -0,0 +1,16 @@ +#ifndef TREE_SITTER_WING_H_ +#define TREE_SITTER_WING_H_ + +typedef struct TSLanguage TSLanguage; + +#ifdef __cplusplus +extern "C" { +#endif + +const TSLanguage *tree_sitter_wing(void); + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_WING_H_ diff --git a/libs/tree-sitter-wing/grammar.js b/libs/tree-sitter-wing/grammar.js index 3e5bd088cb8..fbadd02cd80 100644 --- a/libs/tree-sitter-wing/grammar.js +++ b/libs/tree-sitter-wing/grammar.js @@ -428,15 +428,7 @@ module.exports = grammar({ argument_list: ($) => seq( "(", - choice( - commaSep($.positional_argument), - commaSep($.keyword_argument), - seq( - commaSep($.positional_argument), - ",", - commaSep($.keyword_argument) - ) - ), + commaSep(choice($.positional_argument, $.keyword_argument)), ")" ), @@ -575,13 +567,15 @@ module.exports = grammar({ _container_value_type: ($) => seq("<", field("type_parameter", $._type), ">"), - unwrap_or: ($) => prec.right(PREC.UNWRAP_OR, - seq( - field("left", $.expression), - field("op", "??"), - field("right", $.expression) - ) - ), + unwrap_or: ($) => + prec.right( + PREC.UNWRAP_OR, + seq( + field("left", $.expression), + field("op", "??"), + field("right", $.expression) + ) + ), optional_unwrap: ($) => prec.right(PREC.OPTIONAL_UNWRAP, seq($.expression, "!")), diff --git a/libs/tree-sitter-wing/package.json b/libs/tree-sitter-wing/package.json index 1f490e41e01..1ba95143f83 100644 --- a/libs/tree-sitter-wing/package.json +++ b/libs/tree-sitter-wing/package.json @@ -3,27 +3,44 @@ "version": "0.0.0", "description": "winglang grammar for tree-sitter", "main": "bindings/node", + "types": "bindings/node", "keywords": [ "parsing", "incremental" ], + "files": [ + "grammar.js", + "binding.gyp", + "prebuilds/**", + "bindings/node/*", + "queries/**", + "src/**" + ], "tree-sitter": [ { "scope": "source.wing", + "highlights": "queries/highlights.scm", "file-types": [ "w" ] } ], "dependencies": { - "nan": "^2.17.0" + "node-addon-api": "^7.1.0" + }, + "peerDependencies": { + "tree-sitter": "^0.21.0" + }, + "peerDependenciesMeta": { + "tree_sitter": { + "optional": true + } }, "scripts": { - "test": "tree-sitter test", + "test": "tree-sitter test --update", "parse": "tree-sitter parse", - "test:update": "tree-sitter test --update", "test:watch": "nodemon --watch grammar.js --watch src/scanner.c --exec \"turbo test\"", - "build:generate": "tree-sitter generate", + "build:generate": "tree-sitter generate --no-bindings", "build:wasm": "tree-sitter build-wasm --docker", "build:watch": "nodemon --watch grammar.js --watch src/scanner.c --exec \"turbo compile\"", "playground": "tree-sitter playground", @@ -34,7 +51,7 @@ "extends": "../../package.json" }, "devDependencies": { - "nodemon": "^3.0.1", - "tree-sitter-cli": "0.20.6" + "nodemon": "^3.1.0", + "tree-sitter-cli": "0.22.4" } } diff --git a/libs/tree-sitter-wing/pyproject.toml b/libs/tree-sitter-wing/pyproject.toml new file mode 100644 index 00000000000..7f3a4722ec0 --- /dev/null +++ b/libs/tree-sitter-wing/pyproject.toml @@ -0,0 +1,29 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "tree-sitter-wing" +description = "Wing grammar for tree-sitter" +version = "0.0.0" +keywords = ["incremental", "parsing", "tree-sitter", "wing"] +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Topic :: Software Development :: Compilers", + "Topic :: Text Processing :: Linguistic", + "Typing :: Typed" +] +requires-python = ">=3.8" +license.text = "MIT" +readme = "README.md" + +[project.urls] +Homepage = "https://github.com/winglang/tree-sitter-wing" + +[project.optional-dependencies] +core = ["tree-sitter~=0.21"] + +[tool.cibuildwheel] +build = "cp38-*" +build-frontend = "build" diff --git a/libs/tree-sitter-wing/queries/folds.scm b/libs/tree-sitter-wing/queries/folds.scm new file mode 100644 index 00000000000..60de6116dac --- /dev/null +++ b/libs/tree-sitter-wing/queries/folds.scm @@ -0,0 +1,15 @@ +[ + (class_definition) + (class_implementation) + (interface_definition) + (interface_implementation) + (for_in_loop) + (while_statement) + (if_statement) + (if_let_statement) + (elif_block) + (struct_definition) + (enum_definition) + (try_catch_statement) + (method_definition) +] @fold diff --git a/libs/tree-sitter-wing/queries/highlights.scm b/libs/tree-sitter-wing/queries/highlights.scm index 65f097d67e9..0171e09dec2 100644 --- a/libs/tree-sitter-wing/queries/highlights.scm +++ b/libs/tree-sitter-wing/queries/highlights.scm @@ -1,50 +1,55 @@ -; Classes +(identifier) @variable + +(reference_identifier) @variable + +(member_identifier) @variable.member +; Classes (custom_type) @type -(class_field - name: (identifier) @member -) -(class_definition - name: (identifier) @type -) + +(class_field + name: (identifier) @variable.member) + +(class_definition + name: (identifier) @type) + (method_definition - name: (identifier) @function -) + name: (identifier) @function.method) ; Functions - (keyword_argument_key) @variable.parameter -(call - caller: (reference - (nested_identifier - property: (member_identifier) @function.method)) -) -(call - caller: (reference - (reference_identifier) @function.method) -) + +(call + caller: (reference + (nested_identifier + property: (member_identifier) @function.method.call))) + +(call + caller: (reference + (reference_identifier) @function.method.call)) ; Primitives +(number) @number + +(duration) @constant -[ - (number) - (duration) -] @constant.builtin (string) @string -(bool) @constant.builtin + +(bool) @boolean + (builtin_type) @type.builtin + (json_container_type) @type.builtin ; Special - -(comment) @comment +(comment) @comment @spell [ "(" ")" "{" "}" -] @punctuation.bracket +] @punctuation.bracket [ "-" @@ -75,17 +80,25 @@ "as" "bring" "class" - "else" - "for" - "if" - "in" - "new" "let" "new" - "return" (inflight_specifier) ] @keyword -(identifier) @variable -(reference_identifier) @variable -(member_identifier) @property \ No newline at end of file +[ + "for" + "in" +] @keyword.repeat + +[ + "if" + "else" +] @keyword.conditional + +[ + "pub" + "protected" + "internal" +] @keyword.modifier + +"return" @keyword.return diff --git a/libs/tree-sitter-wing/queries/locals.scm b/libs/tree-sitter-wing/queries/locals.scm index b8350eeee76..9a860c5f2dc 100644 --- a/libs/tree-sitter-wing/queries/locals.scm +++ b/libs/tree-sitter-wing/queries/locals.scm @@ -1,6 +1,6 @@ (block) @local.scope + (variable_definition_statement - name: (identifier) @local.definition -) + name: (identifier) @local.definition) ; TODO: Missing "@local.reference" usage tuned for each relevant identifier location diff --git a/libs/tree-sitter-wing/setup.py b/libs/tree-sitter-wing/setup.py new file mode 100644 index 00000000000..0bbee214828 --- /dev/null +++ b/libs/tree-sitter-wing/setup.py @@ -0,0 +1,60 @@ +from os.path import isdir, join +from platform import system + +from setuptools import Extension, find_packages, setup +from setuptools.command.build import build +from wheel.bdist_wheel import bdist_wheel + + +class Build(build): + def run(self): + if isdir("queries"): + dest = join(self.build_lib, "tree_sitter_wing", "queries") + self.copy_tree("queries", dest) + super().run() + + +class BdistWheel(bdist_wheel): + def get_tag(self): + python, abi, platform = super().get_tag() + if python.startswith("cp"): + python, abi = "cp38", "abi3" + return python, abi, platform + + +setup( + packages=find_packages("bindings/python"), + package_dir={"": "bindings/python"}, + package_data={ + "tree_sitter_wing": ["*.pyi", "py.typed"], + "tree_sitter_wing.queries": ["*.scm"], + }, + ext_package="tree_sitter_wing", + ext_modules=[ + Extension( + name="_binding", + sources=[ + "bindings/python/tree_sitter_wing/binding.c", + "src/parser.c", + "src/scanner.c", + ], + extra_compile_args=[ + "-std=c11", + ] if system() != "Windows" else [ + "/std:c11", + "/utf-8", + ], + define_macros=[ + ("Py_LIMITED_API", "0x03080000"), + ("PY_SSIZE_T_CLEAN", None) + ], + include_dirs=["src"], + py_limited_api=True, + ) + ], + cmdclass={ + "build": Build, + "bdist_wheel": BdistWheel + }, + zip_safe=False +) diff --git a/libs/tree-sitter-wing/src/grammar.json b/libs/tree-sitter-wing/src/grammar.json index 238b1f6a0a8..18ac32e2e77 100644 --- a/libs/tree-sitter-wing/src/grammar.json +++ b/libs/tree-sitter-wing/src/grammar.json @@ -2270,68 +2270,36 @@ "type": "CHOICE", "members": [ { - "type": "CHOICE", + "type": "SEQ", "members": [ { - "type": "SEQ", + "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "positional_argument" }, { - "type": "REPEAT", - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "SYMBOL", - "name": "positional_argument" - } - ] - } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "BLANK" - } - ] + "type": "SYMBOL", + "name": "keyword_argument" } ] }, { - "type": "BLANK" - } - ] - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "keyword_argument" - }, - { - "type": "REPEAT", - "content": { - "type": "SEQ", + "type": "REPEAT", + "content": { + "type": "SEQ", + "members": [ + { + "type": "STRING", + "value": "," + }, + { + "type": "CHOICE", "members": [ { - "type": "STRING", - "value": "," + "type": "SYMBOL", + "name": "positional_argument" }, { "type": "SYMBOL", @@ -2339,117 +2307,15 @@ } ] } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "BLANK" - } - ] - } - ] - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "SEQ", - "members": [ - { - "type": "CHOICE", - "members": [ - { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "positional_argument" - }, - { - "type": "REPEAT", - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "SYMBOL", - "name": "positional_argument" - } - ] - } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "BLANK" - } - ] - } - ] - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "STRING", - "value": "," + ] + } }, { "type": "CHOICE", "members": [ { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "keyword_argument" - }, - { - "type": "REPEAT", - "content": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "SYMBOL", - "name": "keyword_argument" - } - ] - } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "STRING", - "value": "," - }, - { - "type": "BLANK" - } - ] - } - ] + "type": "STRING", + "value": "," }, { "type": "BLANK" @@ -2457,6 +2323,9 @@ ] } ] + }, + { + "type": "BLANK" } ] }, @@ -4581,4 +4450,3 @@ "_literal" ] } - diff --git a/libs/tree-sitter-wing/src/scanner.c b/libs/tree-sitter-wing/src/scanner.c index c4446cd20d8..0ebcccc0337 100644 --- a/libs/tree-sitter-wing/src/scanner.c +++ b/libs/tree-sitter-wing/src/scanner.c @@ -105,8 +105,9 @@ static bool scan_automatic_semicolon(TSLexer * lexer) { skip(lexer); - if (!scan_whitespace_and_comments(lexer)) - return false; + while (iswspace(lexer -> lookahead)) { + skip(lexer); + } switch (lexer -> lookahead) { case ',': @@ -124,9 +125,13 @@ static bool scan_automatic_semicolon(TSLexer * lexer) { case '^': case '|': case '&': - case '/': return false; + // Insert a semicolon before `//` and `/*` + case '/': + skip(lexer); + return lexer -> lookahead == '/' || lexer -> lookahead == '*'; + // Insert a semicolon before `--` and `++`, but not before binary `+` or `-`. case '+': skip(lexer); @@ -212,4 +217,4 @@ bool tree_sitter_wing_external_scanner_scan(void * payload, TSLexer * lexer, } return false; -} \ No newline at end of file +} diff --git a/libs/tree-sitter-wing/test/highlight/class.w b/libs/tree-sitter-wing/test/highlight/class.w new file mode 100644 index 00000000000..602b2f749a2 --- /dev/null +++ b/libs/tree-sitter-wing/test/highlight/class.w @@ -0,0 +1,19 @@ +bring cloud; +// <- @keyword + +class Foo { +// <- @keyword +// ^ @type +// ^ @punctuation.bracket + name: str; +//^ @variable.member +// ^ @type.builtin +// ^ @punctuation.delimiter + new(name: str) { +//^ @keyword +// ^ @variable + this.name = name; +// ^ @punctuation.delimiter +// ^ @operator + } +} diff --git a/libs/tree-sitter-wing/test/highlight/nested_method.w b/libs/tree-sitter-wing/test/highlight/nested_method.w index 8cb5a4be2e1..cb46f7d7f9f 100644 --- a/libs/tree-sitter-wing/test/highlight/nested_method.w +++ b/libs/tree-sitter-wing/test/highlight/nested_method.w @@ -1,4 +1,4 @@ test1.test2.test3(); // <- variable -// ^ property -// ^ function.method +// ^ variable.member +// ^ function.method.call diff --git a/libs/tree-sitter-wing/tree-sitter-dsl.d.ts b/libs/tree-sitter-wing/tree-sitter-dsl.d.ts index 049a56ec927..63f9ed493d9 100644 --- a/libs/tree-sitter-wing/tree-sitter-dsl.d.ts +++ b/libs/tree-sitter-wing/tree-sitter-dsl.d.ts @@ -1,21 +1,19 @@ -// Taken from https://www.npmjs.com/package/tree-sitter-cli - -type AliasRule = {type: 'ALIAS'; named: boolean; content: Rule; value: string}; -type BlankRule = {type: 'BLANK'}; -type ChoiceRule = {type: 'CHOICE'; members: Rule[]}; -type FieldRule = {type: 'FIELD'; name: string; content: Rule}; -type ImmediateTokenRule = {type: 'IMMEDIATE_TOKEN'; content: Rule}; -type PatternRule = {type: 'PATTERN'; value: string}; -type PrecDynamicRule = {type: 'PREC_DYNAMIC'; content: Rule; value: number}; -type PrecLeftRule = {type: 'PREC_LEFT'; content: Rule; value: number}; -type PrecRightRule = {type: 'PREC_RIGHT'; content: Rule; value: number}; -type PrecRule = {type: 'PREC'; content: Rule; value: number}; -type Repeat1Rule = {type: 'REPEAT1'; content: Rule}; -type RepeatRule = {type: 'REPEAT'; content: Rule}; -type SeqRule = {type: 'SEQ'; members: Rule[]}; -type StringRule = {type: 'STRING'; value: string}; -type SymbolRule = {type: 'SYMBOL'; name: Name}; -type TokenRule = {type: 'TOKEN'; content: Rule}; +type AliasRule = { type: 'ALIAS'; named: boolean; content: Rule; value: string }; +type BlankRule = { type: 'BLANK' }; +type ChoiceRule = { type: 'CHOICE'; members: Rule[] }; +type FieldRule = { type: 'FIELD'; name: string; content: Rule }; +type ImmediateTokenRule = { type: 'IMMEDIATE_TOKEN'; content: Rule }; +type PatternRule = { type: 'PATTERN'; value: string }; +type PrecDynamicRule = { type: 'PREC_DYNAMIC'; content: Rule; value: number }; +type PrecLeftRule = { type: 'PREC_LEFT'; content: Rule; value: number }; +type PrecRightRule = { type: 'PREC_RIGHT'; content: Rule; value: number }; +type PrecRule = { type: 'PREC'; content: Rule; value: number }; +type Repeat1Rule = { type: 'REPEAT1'; content: Rule }; +type RepeatRule = { type: 'REPEAT'; content: Rule }; +type SeqRule = { type: 'SEQ'; members: Rule[] }; +type StringRule = { type: 'STRING'; value: string }; +type SymbolRule = { type: 'SYMBOL'; name: Name }; +type TokenRule = { type: 'TOKEN'; content: Rule }; type Rule = | AliasRule @@ -44,14 +42,15 @@ type GrammarSymbols = { type RuleBuilder = ( $: GrammarSymbols, + previous: Rule, ) => RuleOrLiteral; type RuleBuilders< RuleName extends string, BaseGrammarRuleName extends string > = { - [name in RuleName]: RuleBuilder; -}; + [name in RuleName]: RuleBuilder; + }; interface Grammar< RuleName extends string, @@ -70,11 +69,17 @@ interface Grammar< rules: Rules; /** - * An array of arrays of precedence names. Each inner array represents - * a *descending* ordering. Names listed earlier in one of these arrays - * have higher precedence than any names listed later in the same array. + * An array of arrays of precedence names or rules. Each inner array represents + * a *descending* ordering. Names/rules listed earlier in one of these arrays + * have higher precedence than any names/rules listed later in the same array. + * + * Using rules is just a shorthand way for using a name then calling prec() + * with that name. It is just a convenience. */ - precedences?: () => String[][], + precedences?: ( + $: GrammarSymbols, + previous: Rule[][], + ) => RuleOrLiteral[][], /** * An array of arrays of rule names. Each inner array represents a set of @@ -88,6 +93,7 @@ interface Grammar< */ conflicts?: ( $: GrammarSymbols, + previous: Rule[][], ) => RuleOrLiteral[][]; /** @@ -104,7 +110,7 @@ interface Grammar< externals?: ( $: Record>, previous: Rule[], - ) => SymbolRule[]; + ) => RuleOrLiteral[]; /** * An array of tokens that may appear anywhere in the language. This @@ -128,6 +134,7 @@ interface Grammar< */ inline?: ( $: GrammarSymbols, + previous: Rule[], ) => RuleOrLiteral[]; /** @@ -140,6 +147,7 @@ interface Grammar< */ supertypes?: ( $: GrammarSymbols, + previous: Rule[], ) => RuleOrLiteral[]; /** @@ -155,8 +163,8 @@ interface Grammar< type GrammarSchema = { [K in keyof Grammar]: K extends 'rules' - ? Record - : Grammar[K]; + ? Record + : Grammar[K]; }; /** @@ -368,4 +376,4 @@ declare function grammar< >( baseGrammar: GrammarSchema, options: Grammar, -): GrammarSchema; \ No newline at end of file +): GrammarSchema; diff --git a/libs/wingc/Cargo.toml b/libs/wingc/Cargo.toml index fbb69190ff5..792442005c0 100644 --- a/libs/wingc/Cargo.toml +++ b/libs/wingc/Cargo.toml @@ -4,8 +4,8 @@ version = "0.0.0" edition = "2021" [dependencies] -tree-sitter = "0.20.10" -tree-sitter-traversal = "0.1" +# Waiting for https://github.com/tree-sitter/tree-sitter/pull/3293 to be released +tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter.git", rev = "a7a47d561d4e64eaf226f93c4d68076afa67fdda" } derivative = "2.2" tree-sitter-wing = { path = "../tree-sitter-wing" } wingii = { path = "../wingii" } diff --git a/libs/wingc/src/lib.rs b/libs/wingc/src/lib.rs index e072a231403..a78b37bca66 100644 --- a/libs/wingc/src/lib.rs +++ b/libs/wingc/src/lib.rs @@ -61,6 +61,7 @@ mod lifting; pub mod lsp; pub mod parser; pub mod struct_schema; +mod ts_traversal; pub mod type_check; mod type_check_assert; mod valid_json_visitor; diff --git a/libs/wingc/src/lsp/completions.rs b/libs/wingc/src/lsp/completions.rs index c1d4c1541a0..fe08eec9a34 100644 --- a/libs/wingc/src/lsp/completions.rs +++ b/libs/wingc/src/lsp/completions.rs @@ -410,6 +410,12 @@ pub fn on_completion(params: lsp_types::CompletionParams) -> CompletionResponse return vec![]; }; + (fields, *structy) + } else if let ExprKind::JsonMapLiteral { fields } = &expr.kind { + let Some(structy) = types.get_type_from_json_cast(expr.id) else { + return vec![]; + }; + (fields, *structy) } else { return vec![]; @@ -1620,6 +1626,18 @@ Foo { x: "hi", } "# ); + test_completion_list!( + struct_literal_empty_nospace, + r#" +struct Foo { + x: str; +} + +let x: Foo = {} + //^ +"# + ); + test_completion_list!( struct_literal_all, r#" diff --git a/libs/wingc/src/lsp/snapshots/completions/struct_literal_empty_nospace.snap b/libs/wingc/src/lsp/snapshots/completions/struct_literal_empty_nospace.snap new file mode 100644 index 00000000000..2e4a08ccf60 --- /dev/null +++ b/libs/wingc/src/lsp/snapshots/completions/struct_literal_empty_nospace.snap @@ -0,0 +1,16 @@ +--- +source: libs/wingc/src/lsp/completions.rs +--- +- label: "x:" + kind: 5 + detail: str + documentation: + kind: markdown + value: "```wing\nx: str\n```" + sortText: "ab|a|x:" + insertText: "x: $1" + insertTextFormat: 2 + command: + title: triggerCompletion + command: editor.action.triggerSuggest + diff --git a/libs/wingc/src/parser.rs b/libs/wingc/src/parser.rs index 1f74a88453b..7e8a6f88771 100644 --- a/libs/wingc/src/parser.rs +++ b/libs/wingc/src/parser.rs @@ -7,7 +7,6 @@ use std::cell::RefCell; use std::collections::HashSet; use std::{fs, str, vec}; use tree_sitter::Node; -use tree_sitter_traversal::{traverse, Order}; use crate::ast::{ AccessModifier, ArgList, AssignmentKind, BinaryOperator, BringSource, CalleeKind, CatchBlock, Class, ClassField, @@ -17,7 +16,9 @@ use crate::ast::{ UserDefinedType, }; use crate::comp_ctx::{CompilationContext, CompilationPhase}; -use crate::diagnostic::{report_diagnostic, Diagnostic, DiagnosticResult, WingSpan, ERR_EXPECTED_SEMICOLON}; +use crate::diagnostic::{ + report_diagnostic, Diagnostic, DiagnosticResult, WingLocation, WingSpan, ERR_EXPECTED_SEMICOLON, +}; use crate::file_graph::FileGraph; use crate::files::Files; use crate::type_check::{CLASS_INFLIGHT_INIT_NAME, CLASS_INIT_NAME}; @@ -239,7 +240,7 @@ fn parse_wing_file( let language = tree_sitter_wing::language(); let mut tree_sitter_parser = tree_sitter::Parser::new(); - tree_sitter_parser.set_language(language).unwrap(); + tree_sitter_parser.set_language(&language).unwrap(); let tree_sitter_tree = match tree_sitter_parser.parse(&source_text.as_bytes(), None) { Some(tree) => tree, @@ -346,7 +347,7 @@ fn parse_wing_directory( // Create a fake AST (since the directory doesn't have any source code to parse) let mut tree_sitter_parser = tree_sitter::Parser::new(); - tree_sitter_parser.set_language(tree_sitter_wing::language()).unwrap(); + tree_sitter_parser.set_language(&tree_sitter_wing::language()).unwrap(); let tree_sitter_tree = tree_sitter_parser.parse("", None).unwrap(); let scope = Scope::empty(); let dependent_wing_paths = files_and_dirs; @@ -2418,41 +2419,56 @@ impl<'s> Parser<'s> { } /// Given a node, returns the last non-extra node before it. fn last_non_extra(node: Node) -> Node { - let parent = node.parent(); - if let Some(parent) = parent { - if parent.is_extra() { - return Self::last_non_extra(parent); + let mut sibling = node.prev_sibling(); + while let Some(s) = sibling { + if !s.is_extra() { + break; } + sibling = s.prev_sibling(); } - if node.is_extra() { - let mut sibling = node.prev_sibling(); - while let Some(s) = sibling { - if !s.is_extra() { - break; - } - sibling = s.prev_sibling(); - } - return sibling.unwrap_or(node); - } else { - return node; - } + return sibling.unwrap_or(node); } fn report_unhandled_errors(&self, root: &Node) { - let iter = traverse(root.walk(), Order::Pre); - for node in iter { + let iterator = crate::ts_traversal::PostOrderIter::new(root); + for node in iterator { if node.kind() == "AUTOMATIC_SEMICOLON" { - let target_node = Self::last_non_extra(node); + let target_node = Self::last_non_extra(node).range(); + let end_byte = target_node.end_byte; + let end_point: WingLocation = target_node.end_point.into(); + let diag = Diagnostic { message: ERR_EXPECTED_SEMICOLON.to_string(), - span: Some(self.node_span(&target_node)), + span: Some(WingSpan { + start: end_point, + end: end_point, + end_offset: end_byte, + start_offset: end_byte, + file_id: self.source_name.to_string(), + }), annotations: vec![], hints: vec![], }; report_diagnostic(diag); } else if node.kind() == "AUTOMATIC_BLOCK" { - self.add_error("Expected block".to_string(), &Self::last_non_extra(node)); + let target_node = Self::last_non_extra(node).range(); + let end_byte = target_node.end_byte; + let end_point: WingLocation = target_node.end_point.into(); + + let diag = Diagnostic { + message: "Expected block".to_string(), + span: Some(WingSpan { + start: end_point, + end: end_point, + end_offset: end_byte, + start_offset: end_byte, + file_id: self.source_name.to_string(), + }), + annotations: vec![], + hints: vec![], + }; + report_diagnostic(diag); } else if !self.error_nodes.borrow().contains(&node.id()) { if node.is_error() { if node.named_child_count() == 0 { @@ -2738,7 +2754,7 @@ mod tests { // Test get_actual_children_by_field_name let language = tree_sitter_wing::language(); let mut tree_sitter_parser = tree_sitter::Parser::new(); - tree_sitter_parser.set_language(language).unwrap(); + tree_sitter_parser.set_language(&language).unwrap(); let tree_sitter_tree = tree_sitter_parser .parse("let x: ((num)) = 1;".as_bytes(), None) diff --git a/libs/wingc/src/ts_traversal.rs b/libs/wingc/src/ts_traversal.rs new file mode 100644 index 00000000000..e12eefc6815 --- /dev/null +++ b/libs/wingc/src/ts_traversal.rs @@ -0,0 +1,59 @@ +use tree_sitter::Node; + +/// Create a post-order tree iterator for a tree-sitter node. +pub struct PostOrderIter<'a> { + stack: Vec>, +} + +impl<'a> PostOrderIter<'a> { + pub fn new(root: &'a Node) -> Self { + let mut stack = Vec::new(); + stack.push(*root); + PostOrderIter { stack } + } +} + +impl<'a> Iterator for PostOrderIter<'a> { + type Item = Node<'a>; + + fn next(&mut self) -> Option { + if let Some(node) = self.stack.pop() { + for i in (0..node.child_count()).rev() { + self.stack.push(node.child(i).unwrap()); + } + return Some(node); + } else { + None + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use tree_sitter::Parser; + use tree_sitter_wing::language; + + #[test] + fn test_post_order_iter() { + let code = r#" + a; + if true { + b; + } + c; + "#; + let mut parser = Parser::new(); + parser.set_language(&language()).unwrap(); + let tree = parser.parse(code, None).unwrap(); + let root = tree.root_node(); + let nodes: Vec = PostOrderIter::new(&root).collect(); + let reference_nodes = nodes + .iter() + .filter(|n| n.kind() == "reference_identifier") + .map(|n| n.utf8_text(&code.as_bytes()).unwrap().to_string()) + .collect::>(); + + assert_eq!(reference_nodes, vec!["a", "b", "c"]); + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03e3aa655bd..b761ae9d925 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -274,7 +274,7 @@ importers: version: 5.0.3 debug: specifier: ^4.3.4 - version: 4.3.4 + version: 4.3.4(supports-color@5.5.0) dotenv: specifier: ^16.3.1 version: 16.3.1 @@ -647,7 +647,7 @@ importers: version: 0.4.0 debug: specifier: ^4.3.4 - version: 4.3.4 + version: 4.3.4(supports-color@5.5.0) launch-editor: specifier: ^2.6.0 version: 2.6.1 @@ -1196,16 +1196,19 @@ importers: libs/tree-sitter-wing: dependencies: - nan: - specifier: ^2.17.0 - version: 2.18.0 + node-addon-api: + specifier: ^7.1.0 + version: 7.1.0 + tree-sitter: + specifier: ^0.21.0 + version: 0.21.1 devDependencies: nodemon: - specifier: ^3.0.1 - version: 3.0.1 + specifier: ^3.1.0 + version: 3.1.0 tree-sitter-cli: - specifier: 0.20.6 - version: 0.20.6 + specifier: 0.22.4 + version: 0.22.4 libs/wingc: devDependencies: @@ -1501,7 +1504,7 @@ importers: version: 8.5.10 debug: specifier: ^4.3.4 - version: 4.3.4 + version: 4.3.4(supports-color@5.5.0) ws: specifier: ^8.14.2 version: 8.14.2 @@ -3585,7 +3588,7 @@ packages: '@babel/traverse': 7.23.9 '@babel/types': 7.23.9 convert-source-map: 2.0.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -3676,7 +3679,7 @@ packages: '@babel/core': 7.23.9 '@babel/helper-compilation-targets': 7.23.6 '@babel/helper-plugin-utils': 7.22.5 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) lodash.debounce: 4.0.8 resolve: 1.22.6 transitivePeerDependencies: @@ -4910,7 +4913,7 @@ packages: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.23.9 '@babel/types': 7.23.9 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -5078,7 +5081,7 @@ packages: resolution: {integrity: sha512-qvga/nzEtdCJMu/6jJfDqpzbRejvXtNhWFnbubfuYyN5nMNORNXX+POT4j+mQSDQar5bIQ1a812szw/zr47cfw==} requiresBuild: true dependencies: - nan: 2.18.0 + nan: 2.19.0 prebuild-install: 7.1.1 dev: true @@ -5813,7 +5816,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) espree: 9.6.1 globals: 13.23.0 ignore: 5.2.4 @@ -5829,7 +5832,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) espree: 9.6.1 globals: 13.23.0 ignore: 5.2.4 @@ -6002,7 +6005,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -6012,7 +6015,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 2.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -10894,7 +10897,7 @@ packages: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/type-utils': 5.62.0(eslint@8.51.0)(typescript@5.2.2) '@typescript-eslint/utils': 5.62.0(eslint@8.51.0)(typescript@5.2.2) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 graphemer: 1.4.0 ignore: 5.2.4 @@ -10922,7 +10925,7 @@ packages: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/type-utils': 5.62.0(eslint@8.51.0)(typescript@5.3.3) '@typescript-eslint/utils': 5.62.0(eslint@8.51.0)(typescript@5.3.3) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 graphemer: 1.4.0 ignore: 5.2.4 @@ -10951,7 +10954,7 @@ packages: '@typescript-eslint/type-utils': 6.7.4(eslint@8.51.0)(typescript@5.3.3) '@typescript-eslint/utils': 6.7.4(eslint@8.51.0)(typescript@5.3.3) '@typescript-eslint/visitor-keys': 6.7.4 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 graphemer: 1.4.0 ignore: 5.2.4 @@ -10980,7 +10983,7 @@ packages: '@typescript-eslint/type-utils': 7.0.2(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/utils': 7.0.2(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/visitor-keys': 7.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.56.0 graphemer: 1.4.0 ignore: 5.2.4 @@ -11005,7 +11008,7 @@ packages: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.2.2) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 typescript: 5.2.2 transitivePeerDependencies: @@ -11025,7 +11028,7 @@ packages: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.3.3) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 typescript: 5.3.3 transitivePeerDependencies: @@ -11045,7 +11048,7 @@ packages: '@typescript-eslint/types': 6.7.4 '@typescript-eslint/typescript-estree': 6.7.4(typescript@5.3.3) '@typescript-eslint/visitor-keys': 6.7.4 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 typescript: 5.3.3 transitivePeerDependencies: @@ -11066,7 +11069,7 @@ packages: '@typescript-eslint/types': 7.0.2 '@typescript-eslint/typescript-estree': 7.0.2(typescript@5.3.3) '@typescript-eslint/visitor-keys': 7.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.56.0 typescript: 5.3.3 transitivePeerDependencies: @@ -11108,7 +11111,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.2.2) '@typescript-eslint/utils': 5.62.0(eslint@8.51.0)(typescript@5.2.2) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 tsutils: 3.21.0(typescript@5.2.2) typescript: 5.2.2 @@ -11128,7 +11131,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.3.3) '@typescript-eslint/utils': 5.62.0(eslint@8.51.0)(typescript@5.3.3) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 tsutils: 3.21.0(typescript@5.3.3) typescript: 5.3.3 @@ -11148,7 +11151,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 6.7.4(typescript@5.3.3) '@typescript-eslint/utils': 6.7.4(eslint@8.51.0)(typescript@5.3.3) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.51.0 ts-api-utils: 1.0.3(typescript@5.3.3) typescript: 5.3.3 @@ -11168,7 +11171,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 7.0.2(typescript@5.3.3) '@typescript-eslint/utils': 7.0.2(eslint@8.56.0)(typescript@5.3.3) - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.56.0 ts-api-utils: 1.0.3(typescript@5.3.3) typescript: 5.3.3 @@ -11201,7 +11204,7 @@ packages: dependencies: '@typescript-eslint/types': 5.62.0 '@typescript-eslint/visitor-keys': 5.62.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 @@ -11222,7 +11225,7 @@ packages: dependencies: '@typescript-eslint/types': 5.62.0 '@typescript-eslint/visitor-keys': 5.62.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 @@ -11242,7 +11245,7 @@ packages: dependencies: '@typescript-eslint/types': 6.7.4 '@typescript-eslint/visitor-keys': 6.7.4 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 @@ -11263,7 +11266,7 @@ packages: dependencies: '@typescript-eslint/types': 7.0.2 '@typescript-eslint/visitor-keys': 7.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 @@ -11829,7 +11832,7 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -11837,7 +11840,7 @@ packages: resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} engines: {node: '>= 14'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -13220,7 +13223,7 @@ packages: /codespan-wasm@0.4.0: resolution: {integrity: sha512-TVS9MyHIeTV1Zm/wBpgjY1Lyx49Ikj7mccrBrCwWc0/oM7MoeHtVPWwM+Q9CBKWJTZLwp7D1s8PT6NnCqvQrhA==} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: false @@ -13812,7 +13815,7 @@ packages: dependencies: ms: 2.0.0 - /debug@3.2.7(supports-color@5.5.0): + /debug@3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} peerDependencies: supports-color: '*' @@ -13821,9 +13824,8 @@ packages: optional: true dependencies: ms: 2.1.3 - supports-color: 5.5.0 - /debug@4.3.4: + /debug@4.3.4(supports-color@5.5.0): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} peerDependencies: @@ -13833,6 +13835,7 @@ packages: optional: true dependencies: ms: 2.1.2 + supports-color: 5.5.0 /decamelize-keys@1.1.1: resolution: {integrity: sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==} @@ -14083,7 +14086,7 @@ packages: hasBin: true dependencies: address: 1.2.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -14200,7 +14203,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.5.0-dev.20240412 + typescript: 5.5.0-dev.20240413 dev: true /dset@3.1.2: @@ -14620,7 +14623,7 @@ packages: peerDependencies: esbuild: '>=0.12 <1' dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.18.20 transitivePeerDependencies: - supports-color @@ -14834,7 +14837,7 @@ packages: /eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} dependencies: - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 is-core-module: 2.13.0 resolve: 1.22.6 transitivePeerDependencies: @@ -14847,7 +14850,7 @@ packages: eslint: '*' eslint-plugin-import: '*' dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) enhanced-resolve: 5.15.0 eslint: 8.51.0 eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.51.0) @@ -14869,7 +14872,7 @@ packages: eslint: '*' eslint-plugin-import: '*' dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) enhanced-resolve: 5.15.0 eslint: 8.51.0 eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.51.0) @@ -14892,7 +14895,7 @@ packages: eslint: '*' eslint-plugin-import: '*' dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) enhanced-resolve: 5.15.0 eslint: 8.56.0 eslint-module-utils: 2.8.0(@typescript-eslint/parser@7.0.2)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0) @@ -14930,7 +14933,7 @@ packages: optional: true dependencies: '@typescript-eslint/parser': 5.62.0(eslint@8.51.0)(typescript@5.3.3) - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 eslint: 8.51.0 eslint-import-resolver-node: 0.3.9 eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.51.0) @@ -14959,7 +14962,7 @@ packages: optional: true dependencies: '@typescript-eslint/parser': 6.7.4(eslint@8.51.0)(typescript@5.3.3) - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 eslint: 8.51.0 eslint-import-resolver-node: 0.3.9 eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@6.7.4)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.51.0) @@ -14989,7 +14992,7 @@ packages: optional: true dependencies: '@typescript-eslint/parser': 7.0.2(eslint@8.56.0)(typescript@5.3.3) - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@7.0.2)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.56.0) @@ -15012,7 +15015,7 @@ packages: array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 array.prototype.flatmap: 1.3.2 - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 doctrine: 2.1.0 eslint: 8.51.0 eslint-import-resolver-node: 0.3.9 @@ -15046,7 +15049,7 @@ packages: array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 array.prototype.flatmap: 1.3.2 - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 doctrine: 2.1.0 eslint: 8.51.0 eslint-import-resolver-node: 0.3.9 @@ -15081,7 +15084,7 @@ packages: array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 array.prototype.flatmap: 1.3.2 - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 doctrine: 2.1.0 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 @@ -15259,7 +15262,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -15305,7 +15308,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -15536,7 +15539,7 @@ packages: engines: {node: '>= 10.17.0'} hasBin: true dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) get-stream: 5.2.0 yauzl: 2.10.0 optionalDependencies: @@ -16619,7 +16622,7 @@ packages: dependencies: '@tootallnate/once': 2.0.0 agent-base: 6.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: false @@ -16629,7 +16632,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: false @@ -16639,7 +16642,7 @@ packages: engines: {node: '>= 6.0.0'} dependencies: agent-base: 5.1.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -16649,7 +16652,7 @@ packages: engines: {node: '>= 6'} dependencies: agent-base: 6.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -16658,7 +16661,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -16930,7 +16933,7 @@ packages: dependencies: '@ioredis/commands': 1.2.0 cluster-key-slot: 1.1.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) denque: 2.1.0 lodash.defaults: 4.2.0 lodash.isarguments: 3.1.0 @@ -18231,7 +18234,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) flatted: 3.2.9 rfdc: 1.3.0 streamroller: 3.1.5 @@ -18700,7 +18703,7 @@ packages: resolution: {integrity: sha512-o/sd0nMof8kYff+TqcDx3VSrgBTcZpSvYcAHIfHhv5VAuNmisCxjhx6YmxS8PFEpb9z5WKWKPdzf0jM23ro3RQ==} dependencies: '@types/debug': 4.1.12 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) decode-named-character-reference: 1.0.2 devlop: 1.1.0 micromark-core-commonmark: 2.0.0 @@ -18948,8 +18951,9 @@ packages: object-assign: 4.1.1 thenify-all: 1.6.0 - /nan@2.18.0: - resolution: {integrity: sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==} + /nan@2.19.0: + resolution: {integrity: sha512-nO1xXxfh/RWNxfd/XPfbIfFk5vgLsAxUR9y5O0cHMJu/AW9U95JLXqthYHjEp+8gQ5p96K9jUp8nbVOxCdRbtw==} + dev: true /nano-css@5.6.1(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-T2Mhc//CepkTa3X4pUhKgbEheJHYAxD0VptuqFhDbGMUWVV2m+lkNiW/Ieuj35wrfC8Zm0l7HvssQh7zcEttSw==} @@ -19045,6 +19049,16 @@ packages: dev: true optional: true + /node-addon-api@7.1.0: + resolution: {integrity: sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==} + engines: {node: ^16 || ^18 || >= 20} + dev: false + + /node-addon-api@8.0.0: + resolution: {integrity: sha512-ipO7rsHEBqa9STO5C5T10fj732ml+5kLN1cAG8/jdHd56ldQeGj3Q7+scUS+VHK/qy1zLEwC4wMK5+yM0btPvw==} + engines: {node: ^18 || ^20 || >= 21} + dev: false + /node-dir@0.1.17: resolution: {integrity: sha512-tmPX422rYgofd4epzrNoOXiE8XFZYOcCq1vD7MAXCDO+O+zndlA2ztdKKMa+EeuBG5tHETpr4ml4RGgpqDCCAg==} engines: {node: '>= 0.10.5'} @@ -19097,6 +19111,11 @@ packages: engines: {node: '>= 6.13.0'} dev: false + /node-gyp-build@4.8.0: + resolution: {integrity: sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==} + hasBin: true + dev: false + /node-gyp@9.4.0: resolution: {integrity: sha512-dMXsYP6gc9rRbejLXmTbVRYjAHw7ppswsKyMxuxJxxOHzluIO1rGp9TOQgjFJ+2MCqcOcQTOPB/8Xwhr+7s4Eg==} engines: {node: ^12.13 || ^14.13 || >=16} @@ -19129,13 +19148,13 @@ packages: resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} dev: true - /nodemon@3.0.1: - resolution: {integrity: sha512-g9AZ7HmkhQkqXkRc20w+ZfQ73cHLbE8hnPbtaFbFtCumZsjyMhKk9LajQ07U5Ux28lvFjZ5X7HvWR1xzU8jHVw==} + /nodemon@3.1.0: + resolution: {integrity: sha512-xqlktYlDMCepBJd43ZQhjWwMw2obW/JRvkrLxq5RCNcuDDX1DbcPT+qT1IlIIdf+DhnWs90JpTMe+Y5KxOchvA==} engines: {node: '>=10'} hasBin: true dependencies: chokidar: 3.5.3 - debug: 3.2.7(supports-color@5.5.0) + debug: 4.3.4(supports-color@5.5.0) ignore-by-default: 1.0.1 minimatch: 3.1.2 pstree.remy: 1.1.8 @@ -20380,7 +20399,7 @@ packages: engines: {node: '>=8.16.0'} dependencies: '@types/mime-types': 2.1.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) extract-zip: 1.7.0 https-proxy-agent: 4.0.0 mime: 3.0.0(patch_hash=2he2uszztbibyal6zfzmv2a2oa) @@ -21088,7 +21107,7 @@ packages: resolution: {integrity: sha512-wfI3pk7EE80lCIXprqh7ym48IHYdwmAAzESdbU8Q9l7pnRCk9LEhpbOTNKjz6FARLm/Bl5m+4F0ABxOkYUujSQ==} engines: {node: '>=12'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) extend: 3.0.2 transitivePeerDependencies: - supports-color @@ -21099,7 +21118,7 @@ packages: engines: {node: '>=14'} dependencies: '@types/request': 2.48.11 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) extend: 3.0.2 teeny-request: 9.0.0 transitivePeerDependencies: @@ -21527,7 +21546,7 @@ packages: engines: {node: '>= 10'} dependencies: agent-base: 6.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) socks: 2.7.1 transitivePeerDependencies: - supports-color @@ -21538,7 +21557,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) socks: 2.7.1 transitivePeerDependencies: - supports-color @@ -21800,7 +21819,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) fs-extra: 8.1.0 transitivePeerDependencies: - supports-color @@ -22359,12 +22378,20 @@ packages: hasBin: true dev: true - /tree-sitter-cli@0.20.6: - resolution: {integrity: sha512-tjbAeuGSMhco/EnsThjWkQbDIYMDmdkWsTPsa/NJAW7bjaki9P7oM9TkLxfdlnm4LXd1wR5wVSM2/RTLtZbm6A==} + /tree-sitter-cli@0.22.4: + resolution: {integrity: sha512-Zli7yeD+ocVWm+au5YLJKLyxzvUirenomOgwapNZU8bpYt/CZMpEeya9eK/tEQAd7NDOQSvAnvhJXbPbwUdgMQ==} hasBin: true requiresBuild: true dev: true + /tree-sitter@0.21.1: + resolution: {integrity: sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==} + requiresBuild: true + dependencies: + node-addon-api: 8.0.0 + node-gyp-build: 4.8.0 + dev: false + /treeverse@3.0.0: resolution: {integrity: sha512-gcANaAnd2QDZFmHFEOF4k7uc1J/6a6z3DJMd/QwEyxLoKGiptJRwid582r7QIsFlFMIZ3SnxfS52S4hm2DHkuQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -22444,7 +22471,7 @@ packages: bundle-require: 4.0.2(esbuild@0.17.19) cac: 6.7.14 chokidar: 3.5.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.17.19 execa: 5.1.1 globby: 11.1.0 @@ -22483,7 +22510,7 @@ packages: bundle-require: 4.0.2(esbuild@0.19.12) cac: 6.7.14 chokidar: 3.5.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.19.12 execa: 5.1.1 globby: 11.1.0 @@ -22523,7 +22550,7 @@ packages: bundle-require: 4.0.2(esbuild@0.19.12) cac: 6.7.14 chokidar: 3.5.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.19.12 execa: 5.1.1 globby: 11.1.0 @@ -22563,7 +22590,7 @@ packages: bundle-require: 4.0.2(esbuild@0.19.12) cac: 6.7.14 chokidar: 3.5.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) esbuild: 0.19.12 execa: 5.1.1 globby: 11.1.0 @@ -22614,7 +22641,7 @@ packages: engines: {node: ^16.14.0 || >=18.0.0} dependencies: '@tufjs/models': 2.0.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) make-fetch-happen: 13.0.0 transitivePeerDependencies: - supports-color @@ -22809,8 +22836,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - /typescript@5.5.0-dev.20240412: - resolution: {integrity: sha512-DfE8jAzZf9/FHHo0CMnIL6uFZ6Q1bJ4PCtpBd9Ytbfi0pRREKVJofJEHFbRXADT6Kq1twB4iiqvdc/rGbiBq7g==} + /typescript@5.5.0-dev.20240413: + resolution: {integrity: sha512-9Xha/54eUa9rMSYHTmP37pxf7NoWEWR/URl9TjZy2Fd7931boHHrE7k0QrtXFs2uXaIyC9v7I/Se8pGsQ7V14A==} engines: {node: '>=14.17'} hasBin: true dev: true @@ -23171,7 +23198,7 @@ packages: hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) mlly: 1.4.2 pathe: 1.1.1 picocolors: 1.0.0 @@ -23193,7 +23220,7 @@ packages: hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) pathe: 1.1.1 picocolors: 1.0.0 vite: 5.1.4(@types/node@20.11.0) @@ -23323,7 +23350,7 @@ packages: acorn-walk: 8.2.0 cac: 6.7.14 chai: 4.3.10 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) happy-dom: 9.20.3 local-pkg: 0.4.3 magic-string: 0.30.4 @@ -23379,7 +23406,7 @@ packages: '@vitest/utils': 1.3.1 acorn-walk: 8.3.2 chai: 4.3.10 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) execa: 8.0.1 local-pkg: 0.5.0 magic-string: 0.30.7 @@ -23454,7 +23481,7 @@ packages: dependencies: '@cowasm/memfs': 3.5.1 '@wapython/unionfs': 4.5.7 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) fflate: 0.7.4 path-browserify: 1.0.1 randomfill: 1.0.4 diff --git a/tools/hangar/__snapshots__/invalid.ts.snap b/tools/hangar/__snapshots__/invalid.ts.snap index c6e91e56f28..8ca836460cf 100644 --- a/tools/hangar/__snapshots__/invalid.ts.snap +++ b/tools/hangar/__snapshots__/invalid.ts.snap @@ -1560,18 +1560,18 @@ Duration " `; exports[`function_call_arity.test.w 1`] = ` -"error: Unexpected 'identifier' - --> ../../../examples/tests/invalid/function_call_arity.test.w:31:62 +"error: Positional arguments must come before named arguments + --> ../../../examples/tests/invalid/function_call_arity.test.w:31:61 | 31 | invalidCombinationFunc2(1, 2, prefix: \\"debug\\", priority: 0, \\"hello\\", \\"world\\"); - | ^^^^^ Unexpected 'identifier' + | ^^^^^^^ Positional arguments must come before named arguments -error: Unexpected 'identifier' - --> ../../../examples/tests/invalid/function_call_arity.test.w:31:71 +error: Positional arguments must come before named arguments + --> ../../../examples/tests/invalid/function_call_arity.test.w:31:70 | 31 | invalidCombinationFunc2(1, 2, prefix: \\"debug\\", priority: 0, \\"hello\\", \\"world\\"); - | ^^^^^ Unexpected 'identifier' + | ^^^^^^^ Positional arguments must come before named arguments error: Expected 2 positional argument(s) but got 0 @@ -1644,6 +1644,13 @@ error: Expected type to be \\"bool\\", but got \\"num\\" instead | ^ Expected type to be \\"bool\\", but got \\"num\\" instead +error: Expected type to be \\"Options\\", but got \\"str\\" instead + --> ../../../examples/tests/invalid/function_call_arity.test.w:31:61 + | +31 | invalidCombinationFunc2(1, 2, prefix: \\"debug\\", priority: 0, \\"hello\\", \\"world\\"); + | ^^^^^^^ Expected type to be \\"Options\\", but got \\"str\\" instead + + Tests 1 failed (1) Snapshots 1 skipped @@ -1717,11 +1724,11 @@ Duration " `; exports[`function_variadic_definition.test.w 1`] = ` -"error: Unknown parser error +"error: Positional arguments must come before named arguments --> ../../../examples/tests/invalid/function_variadic_definition.test.w:15:13 | 15 | f5(args: 1, 2); - | ^ Unknown parser error + | ^ Positional arguments must come before named arguments error: Variadic parameters must always be the last parameter in a function. @@ -2818,10 +2825,10 @@ exports[`missing_semicolon.test.w 1`] = ` error: Expected ';' - --> ../../../examples/tests/invalid/missing_semicolon.test.w:16:9 + --> ../../../examples/tests/invalid/missing_semicolon.test.w:16:10 | 16 | let x = 5 // - | ^ Expected ';' + | ^ Expected ';' error: Expected '}' @@ -3821,11 +3828,11 @@ Duration " `; exports[`struct_expansion.test.w 1`] = ` -"error: Unexpected 'keyword_argument' - --> ../../../examples/tests/invalid/struct_expansion.test.w:11:15 +"error: Positional arguments must come before named arguments + --> ../../../examples/tests/invalid/struct_expansion.test.w:11:33 | 11 | bucket1.put(file: \\"file.txt\\", \\"data\\"); - | ^^^^^^^^^^^^^^^^ Unexpected 'keyword_argument' + | ^^^^^^ Positional arguments must come before named arguments error: \\"bublic\\" is not a field of \\"BucketProps\\" @@ -3868,11 +3875,18 @@ error: Expected type to be \\"inflight (event: str?): str?\\", but got \\"inflig | ^^^^^^^ Expected type to be \\"inflight (event: str?): str?\\", but got \\"inflight (event: str): unknown\\" instead -error: Expected between 2 and 3 positional arguments or named arguments for the last parameter but got 1 +error: \\"file\\" is not a field of \\"BucketPutOptions\\" + --> ../../../examples/tests/invalid/struct_expansion.test.w:11:3 + | +11 | bucket1.put(file: \\"file.txt\\", \\"data\\"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \\"file\\" is not a field of \\"BucketPutOptions\\" + + +error: Missing required field \\"contentType\\" from \\"BucketPutOptions\\" --> ../../../examples/tests/invalid/struct_expansion.test.w:11:3 | 11 | bucket1.put(file: \\"file.txt\\", \\"data\\"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected between 2 and 3 positional arguments or named arguments for the last parameter but got 1 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Missing required field \\"contentType\\" from \\"BucketPutOptions\\"