difftreelog
fix rowan-related test failures
in: master
8 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -19,9 +19,9 @@
[[package]]
name = "ahash"
-version = "0.8.6"
+version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
+checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff"
dependencies = [
"cfg-if",
"once_cell",
@@ -56,9 +56,9 @@
[[package]]
name = "anstream"
-version = "0.6.5"
+version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6"
+checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540"
dependencies = [
"anstyle",
"anstyle-parse",
@@ -70,9 +70,9 @@
[[package]]
name = "anstyle"
-version = "1.0.4"
+version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
+checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
[[package]]
name = "anstyle-parse"
@@ -89,7 +89,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648"
dependencies = [
- "windows-sys 0.52.0",
+ "windows-sys",
]
[[package]]
@@ -99,14 +99,14 @@
checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
dependencies = [
"anstyle",
- "windows-sys 0.52.0",
+ "windows-sys",
]
[[package]]
name = "anyhow"
-version = "1.0.75"
+version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
+checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1"
[[package]]
name = "ass-stroke"
@@ -152,9 +152,9 @@
[[package]]
name = "base64"
-version = "0.21.5"
+version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9"
+checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
[[package]]
name = "beef"
@@ -179,9 +179,9 @@
[[package]]
name = "bitflags"
-version = "2.4.1"
+version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
+checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]]
name = "block-buffer"
@@ -215,9 +215,9 @@
[[package]]
name = "clap"
-version = "4.4.11"
+version = "4.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2"
+checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da"
dependencies = [
"clap_builder",
"clap_derive",
@@ -225,42 +225,42 @@
[[package]]
name = "clap_builder"
-version = "4.4.11"
+version = "4.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb"
+checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
- "strsim",
+ "strsim 0.11.0",
]
[[package]]
name = "clap_complete"
-version = "4.4.4"
+version = "4.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae"
+checksum = "885e4d7d5af40bfb99ae6f9433e292feac98d452dcb3ec3d25dfe7552b77da8c"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
-version = "4.4.7"
+version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
+checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47"
dependencies = [
"heck",
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.50",
]
[[package]]
name = "clap_lex"
-version = "0.6.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
+checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
[[package]]
name = "colorchoice"
@@ -270,14 +270,14 @@
[[package]]
name = "console"
-version = "0.15.7"
+version = "0.15.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8"
+checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb"
dependencies = [
"encode_unicode",
"lazy_static",
"libc",
- "windows-sys 0.45.0",
+ "windows-sys",
]
[[package]]
@@ -288,31 +288,27 @@
[[package]]
name = "cpufeatures"
-version = "0.2.11"
+version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0"
+checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504"
dependencies = [
"libc",
]
[[package]]
name = "crossbeam-channel"
-version = "0.5.8"
+version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
+checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b"
dependencies = [
- "cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
-version = "0.8.16"
+version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
-dependencies = [
- "cfg-if",
-]
+checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
[[package]]
name = "crypto-common"
@@ -353,7 +349,7 @@
dependencies = [
"anyhow",
"bumpalo",
- "indexmap 2.1.0",
+ "indexmap 2.2.3",
"rustc-hash",
"serde",
"unicode-width",
@@ -390,7 +386,7 @@
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
"libc",
- "windows-sys 0.52.0",
+ "windows-sys",
]
[[package]]
@@ -485,9 +481,9 @@
[[package]]
name = "hermit-abi"
-version = "0.3.3"
+version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
+checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd"
[[package]]
name = "idna"
@@ -511,9 +507,9 @@
[[package]]
name = "indexmap"
-version = "2.1.0"
+version = "2.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
+checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177"
dependencies = [
"equivalent",
"hashbrown 0.14.3",
@@ -528,9 +524,9 @@
[[package]]
name = "insta"
-version = "1.34.0"
+version = "1.35.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d64600be34b2fcfc267740a243fa7744441bb4947a619ac4e5bb6507f35fbfc"
+checksum = "7c985c1bef99cf13c58fade470483d81a2bfe846ebde60ed28cc2dddec2df9e2"
dependencies = [
"console",
"lazy_static",
@@ -541,20 +537,20 @@
[[package]]
name = "is-terminal"
-version = "0.4.9"
+version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
+checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b"
dependencies = [
"hermit-abi",
- "rustix",
- "windows-sys 0.48.0",
+ "libc",
+ "windows-sys",
]
[[package]]
name = "is_ci"
-version = "1.1.1"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb"
+checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45"
[[package]]
name = "itertools"
@@ -618,7 +614,7 @@
"rustc-hash",
"serde",
"static_assertions",
- "strsim",
+ "strsim 0.10.0",
"thiserror",
]
@@ -687,7 +683,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.50",
]
[[package]]
@@ -766,9 +762,9 @@
[[package]]
name = "libc"
-version = "0.2.151"
+version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
+checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "libjsonnet"
@@ -788,9 +784,9 @@
[[package]]
name = "linux-raw-sys"
-version = "0.4.12"
+version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
+checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "lock_api"
@@ -842,9 +838,9 @@
[[package]]
name = "lsp-server"
-version = "0.7.5"
+version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb69ba934913ebf0ef3b3dd762f0149bf993decd571d094b646de09c2e456732"
+checksum = "248f65b78f6db5d8e1b1604b4098a28b43d21a8eb1deeca22b1c421b276c7095"
dependencies = [
"crossbeam-channel",
"log",
@@ -873,9 +869,9 @@
[[package]]
name = "memchr"
-version = "2.6.4"
+version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
+checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
[[package]]
name = "memoffset"
@@ -915,7 +911,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.50",
]
[[package]]
@@ -939,9 +935,9 @@
[[package]]
name = "miniz_oxide"
-version = "0.7.1"
+version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
+checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7"
dependencies = [
"adler",
]
@@ -960,28 +956,27 @@
[[package]]
name = "num-integer"
-version = "0.1.45"
+version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
+checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
dependencies = [
- "autocfg",
"num-traits",
]
[[package]]
name = "num-traits"
-version = "0.2.17"
+version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
+checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
[[package]]
name = "object"
-version = "0.32.1"
+version = "0.32.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
+checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
dependencies = [
"memchr",
]
@@ -1068,18 +1063,18 @@
[[package]]
name = "proc-macro2"
-version = "1.0.70"
+version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
+checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
-version = "1.0.33"
+version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
+checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
@@ -1194,9 +1189,9 @@
[[package]]
name = "regex"
-version = "1.10.2"
+version = "1.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
+checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
dependencies = [
"aho-corasick",
"memchr",
@@ -1206,9 +1201,9 @@
[[package]]
name = "regex-automata"
-version = "0.4.3"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
+checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
dependencies = [
"aho-corasick",
"memchr",
@@ -1254,15 +1249,15 @@
[[package]]
name = "rustix"
-version = "0.38.28"
+version = "0.38.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
+checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949"
dependencies = [
- "bitflags 2.4.1",
+ "bitflags 2.4.2",
"errno",
"libc",
"linux-raw-sys",
- "windows-sys 0.52.0",
+ "windows-sys",
]
[[package]]
@@ -1279,29 +1274,29 @@
[[package]]
name = "serde"
-version = "1.0.193"
+version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
+checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.193"
+version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
+checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.50",
]
[[package]]
name = "serde_json"
-version = "1.0.108"
+version = "1.0.114"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
+checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0"
dependencies = [
"itoa",
"ryu",
@@ -1316,7 +1311,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.50",
]
[[package]]
@@ -1365,9 +1360,9 @@
[[package]]
name = "similar"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2aeaf503862c419d66959f5d7ca015337d864e9c49485d771b732e2a20453597"
+checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21"
[[package]]
name = "smallvec"
@@ -1394,6 +1389,12 @@
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
+name = "strsim"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01"
+
+[[package]]
name = "structdump"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1456,9 +1457,9 @@
[[package]]
name = "syn"
-version = "2.0.39"
+version = "2.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
+checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb"
dependencies = [
"proc-macro2",
"quote",
@@ -1467,15 +1468,14 @@
[[package]]
name = "tempfile"
-version = "3.8.1"
+version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
+checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67"
dependencies = [
"cfg-if",
"fastrand",
- "redox_syscall",
"rustix",
- "windows-sys 0.48.0",
+ "windows-sys",
]
[[package]]
@@ -1517,22 +1517,22 @@
[[package]]
name = "thiserror"
-version = "1.0.50"
+version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
+checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.50"
+version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
+checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.50",
]
[[package]]
@@ -1652,27 +1652,9 @@
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-
-[[package]]
-name = "windows-sys"
-version = "0.45.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
-dependencies = [
- "windows-targets 0.42.2",
-]
[[package]]
name = "windows-sys"
-version = "0.48.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
-dependencies = [
- "windows-targets 0.48.5",
-]
-
-[[package]]
-name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
@@ -1682,21 +1664,6 @@
[[package]]
name = "windows-targets"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
-dependencies = [
- "windows_aarch64_gnullvm 0.42.2",
- "windows_aarch64_msvc 0.42.2",
- "windows_i686_gnu 0.42.2",
- "windows_i686_msvc 0.42.2",
- "windows_x86_64_gnu 0.42.2",
- "windows_x86_64_gnullvm 0.42.2",
- "windows_x86_64_msvc 0.42.2",
-]
-
-[[package]]
-name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
@@ -1727,12 +1694,6 @@
[[package]]
name = "windows_aarch64_gnullvm"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
-
-[[package]]
-name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
@@ -1742,12 +1703,6 @@
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
-
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]]
name = "windows_aarch64_msvc"
@@ -1760,12 +1715,6 @@
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
-
-[[package]]
-name = "windows_i686_gnu"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]]
name = "windows_i686_gnu"
@@ -1778,12 +1727,6 @@
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
-
-[[package]]
-name = "windows_i686_msvc"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]]
name = "windows_i686_msvc"
@@ -1799,12 +1742,6 @@
[[package]]
name = "windows_x86_64_gnu"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
-
-[[package]]
-name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
@@ -1814,12 +1751,6 @@
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
-
-[[package]]
-name = "windows_x86_64_gnullvm"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]]
name = "windows_x86_64_gnullvm"
@@ -1835,12 +1766,6 @@
[[package]]
name = "windows_x86_64_msvc"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
-
-[[package]]
-name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
@@ -1871,7 +1796,7 @@
version = "0.1.0"
dependencies = [
"anyhow",
- "indexmap 2.1.0",
+ "indexmap 2.2.3",
"itertools",
"proc-macro2",
"quote",
@@ -1899,20 +1824,20 @@
[[package]]
name = "zerocopy"
-version = "0.7.30"
+version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "306dca4455518f1f31635ec308b6b3e4eb1b11758cefafc782827d0aa7acb5c7"
+checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
-version = "0.7.30"
+version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be912bf68235a88fbefd1b73415cb218405958d1655b2ece9035a19920bdf6ba"
+checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.39",
+ "syn 2.0.50",
]
Cargo.tomldiffbeforeafterboth--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,24 +18,24 @@
jrsonnet-gcmodule = "0.3.6"
ass-stroke = { git = "https://github.com/CertainLach/ass-stroke", version = "0.1.0" }
-serde = "1.0.190"
-serde_json = "1.0.107"
+serde = "1.0.197"
+serde_json = "1.0.114"
serde_yaml_with_quirks = "0.8.24"
-anyhow = "1.0.48"
+anyhow = "1.0.80"
thiserror = "1.0"
mimallocator = "0.1.3"
indoc = "2.0"
-dprint-core = "0.63.2"
-insta = "1.15"
-tempfile = "3.8"
+dprint-core = "0.63.3"
+insta = "1.35"
+tempfile = "3.10"
pathdiff = "0.2.1"
-hashbrown = "0.14.2"
+hashbrown = "0.14.3"
static_assertions = "1.1"
rustc-hash = "1.1"
bincode = "1.3"
-annotate-snippets = "0.9.1"
-num-bigint = "0.4.3"
+annotate-snippets = "0.9.2"
+num-bigint = "0.4.4"
derivative = "2.2.0"
strsim = "0.10.0"
structdump = "0.2.0"
@@ -44,28 +44,28 @@
syn = "2.0"
peg = "0.8.2"
drop_bomb = "0.1.5"
-logos = "0.12.0"
-miette = "5.5.0"
+logos = "0.12.1"
+miette = "5.10.0"
rowan = "0.15"
text-size = "1.1"
md5 = "0.7.0"
-sha1 = "0.10.5"
-sha2 = "0.10.6"
+sha1 = "0.10.6"
+sha2 = "0.10.8"
sha3 = "0.10.8"
-base64 = "0.21.0"
-indexmap = "2.0.2"
+base64 = "0.21.7"
+indexmap = "2.2.3"
itertools = "0.11.0"
ungrammar = "1.16.1"
-xshell = "0.2.2"
+xshell = "0.2.5"
-clap = "4.4"
-clap_complete = "4.4"
+clap = "4.5"
+clap_complete = "4.5"
-lsp-server = "0.7.4"
+lsp-server = "0.7.6"
lsp-types = "0.94.1"
-regex = "1.8.4"
-lru = "0.10.0"
+regex = "1.10.3"
+lru = "0.10.1"
#[profile.test]
#opt-level = 1
cmds/jrsonnet-fmt/src/children.rsdiffbeforeafterboth--- a/cmds/jrsonnet-fmt/src/children.rs
+++ b/cmds/jrsonnet-fmt/src/children.rs
@@ -60,41 +60,6 @@
out
}
-pub fn trivia_between(
- node: SyntaxNode,
- start: Option<&SyntaxElement>,
- end: Option<&SyntaxElement>,
-) -> EndingComments {
- let mut iter = node.children_with_tokens().peekable();
- while iter.peek() != start {
- iter.next();
- }
- iter.next();
-
- let loose = start.is_none() || end.is_none();
-
- let mut out = Vec::new();
- for item in iter.take_while(|i| Some(i) != end) {
- if let Some(trivia) = item.as_token().cloned().and_then(Trivia::cast) {
- out.push(Ok(trivia));
- } else if CustomError::can_cast(item.kind()) {
- out.push(Err(item.to_string()))
- } else if loose {
- break;
- } else {
- assert!(
- TS![, ;].contains(item.kind()),
- "silently eaten token: {:?}",
- item.kind()
- )
- }
- }
- EndingComments {
- should_start_with_newline: should_start_with_newline(None, &out),
- trivia: out,
- }
-}
-
pub fn children_between<T: AstNode + Debug>(
node: SyntaxNode,
start: Option<&SyntaxElement>,
cmds/jrsonnet-fmt/src/main.rsdiffbeforeafterboth1use std::{2 any::type_name,3 fs,4 io::{self, Write},5 path::PathBuf,6 process,7};89use children::{children_between, trivia_before};10use clap::Parser;11use dprint_core::formatting::{PrintItems, PrintOptions};12use jrsonnet_rowan_parser::{13 nodes::{14 ArgsDesc, Assertion, BinaryOperator, Bind, CompSpec, Destruct, DestructArrayPart,15 DestructRest, Expr, ExprBase, FieldName, ForSpec, IfSpec, ImportKind, Literal, Member,16 Name, Number, ObjBody, ObjLocal, ParamsDesc, SliceDesc, SourceFile, Stmt, Suffix, Text,17 UnaryOperator, Visibility,18 },19 AstNode, AstToken, SyntaxToken,20};2122use crate::{23 children::{trivia_after, trivia_between},24 comments::{format_comments, CommentLocation},25};2627mod children;28mod comments;29#[cfg(test)]30mod tests;3132pub trait Printable {33 fn print(&self) -> PrintItems;34}3536macro_rules! pi {37 (@i; $($t:tt)*) => {{38 #[allow(unused_mut)]39 let mut o = dprint_core::formatting::PrintItems::new();40 pi!(@s; o: $($t)*);41 o42 }};43 (@s; $o:ident: str($e:expr $(,)?) $($t:tt)*) => {{44 $o.push_str($e);45 pi!(@s; $o: $($t)*);46 }};47 (@s; $o:ident: string($e:expr $(,)?) $($t:tt)*) => {{48 $o.push_string($e);49 pi!(@s; $o: $($t)*);50 }};51 (@s; $o:ident: nl $($t:tt)*) => {{52 $o.push_signal(dprint_core::formatting::Signal::NewLine);53 pi!(@s; $o: $($t)*);54 }};55 (@s; $o:ident: tab $($t:tt)*) => {{56 $o.push_signal(dprint_core::formatting::Signal::Tab);57 pi!(@s; $o: $($t)*);58 }};59 (@s; $o:ident: >i $($t:tt)*) => {{60 $o.push_signal(dprint_core::formatting::Signal::StartIndent);61 pi!(@s; $o: $($t)*);62 }};63 (@s; $o:ident: <i $($t:tt)*) => {{64 $o.push_signal(dprint_core::formatting::Signal::FinishIndent);65 pi!(@s; $o: $($t)*);66 }};67 (@s; $o:ident: {$expr:expr} $($t:tt)*) => {{68 $o.extend($expr.print());69 pi!(@s; $o: $($t)*);70 }};71 (@s; $o:ident: items($expr:expr) $($t:tt)*) => {{72 $o.extend($expr);73 pi!(@s; $o: $($t)*);74 }};75 (@s; $o:ident: if ($e:expr)($($then:tt)*) $($t:tt)*) => {{76 if $e {77 pi!(@s; $o: $($then)*);78 }79 pi!(@s; $o: $($t)*);80 }};81 (@s; $o:ident: ifelse ($e:expr)($($then:tt)*)($($else:tt)*) $($t:tt)*) => {{82 if $e {83 pi!(@s; $o: $($then)*);84 } else {85 pi!(@s; $o: $($else)*);86 }87 pi!(@s; $o: $($t)*);88 }};89 (@s; $i:ident:) => {}90}91macro_rules! p {92 (new: $($t:tt)*) => {93 pi!(@i; $($t)*)94 };95 ($o:ident: $($t:tt)*) => {96 pi!(@s; $o: $($t)*)97 };98}99pub(crate) use p;100pub(crate) use pi;101102impl<P> Printable for Option<P>103where104 P: Printable,105{106 fn print(&self) -> PrintItems {107 if let Some(v) = self {108 v.print()109 } else {110 p!(new: string(111 format!(112 "/*missing {}*/",113 type_name::<P>().replace("jrsonnet_rowan_parser::generated::nodes::", "")114 ),115 ))116 }117 }118}119120impl Printable for SyntaxToken {121 fn print(&self) -> PrintItems {122 p!(new: string(self.to_string()))123 }124}125126impl Printable for Text {127 fn print(&self) -> PrintItems {128 p!(new: string(format!("{}", self)))129 }130}131impl Printable for Number {132 fn print(&self) -> PrintItems {133 p!(new: string(format!("{}", self)))134 }135}136137impl Printable for Name {138 fn print(&self) -> PrintItems {139 p!(new: {self.ident_lit()})140 }141}142143impl Printable for DestructRest {144 fn print(&self) -> PrintItems {145 let mut pi = p!(new: str("..."));146 if let Some(name) = self.into() {147 p!(pi: {name});148 }149 pi150 }151}152153impl Printable for Destruct {154 fn print(&self) -> PrintItems {155 let mut pi = p!(new:);156 match self {157 Destruct::DestructFull(f) => {158 p!(pi: {f.name()})159 }160 Destruct::DestructSkip(_) => p!(pi: str("?")),161 Destruct::DestructArray(a) => {162 p!(pi: str("[") >i nl);163 for el in a.destruct_array_parts() {164 match el {165 DestructArrayPart::DestructArrayElement(e) => {166 p!(pi: {e.destruct()} str(",") nl)167 }168 DestructArrayPart::DestructRest(d) => {169 p!(pi: {d} str(",") nl)170 }171 }172 }173 p!(pi: <i str("]"));174 }175 Destruct::DestructObject(o) => {176 p!(pi: str("{") >i nl);177 for item in o.destruct_object_fields() {178 p!(pi: {item.field()});179 if let Some(des) = item.destruct() {180 p!(pi: str(": ") {des})181 }182 if let Some(def) = item.expr() {183 p!(pi: str(" = ") {def});184 }185 p!(pi: str(",") nl);186 }187 if let Some(rest) = o.destruct_rest() {188 p!(pi: {rest} nl)189 }190 p!(pi: <i str("}"));191 }192 }193 pi194 }195}196197impl Printable for FieldName {198 fn print(&self) -> PrintItems {199 match self {200 FieldName::FieldNameFixed(f) => {201 if let Some(id) = f.id() {202 p!(new: {id})203 } else if let Some(str) = f.text() {204 p!(new: {str})205 } else {206 p!(new: str("/*missing FieldName*/"))207 }208 }209 FieldName::FieldNameDynamic(d) => {210 p!(new: str("[") {d.expr()} str("]"))211 }212 }213 }214}215216impl Printable for Visibility {217 fn print(&self) -> PrintItems {218 p!(new: string(self.to_string()))219 }220}221222impl Printable for ObjLocal {223 fn print(&self) -> PrintItems {224 p!(new: str("local ") {self.bind()})225 }226}227228impl Printable for Assertion {229 fn print(&self) -> PrintItems {230 let mut pi = p!(new: str("assert ") {self.condition()});231 if self.colon_token().is_some() || self.message().is_some() {232 p!(pi: str(": ") {self.message()})233 }234 pi235 }236}237238impl Printable for ParamsDesc {239 fn print(&self) -> PrintItems {240 let mut pi = p!(new: str("(") >i nl);241 for param in self.params() {242 p!(pi: {param.destruct()});243 if param.assign_token().is_some() || param.expr().is_some() {244 p!(pi: str(" = ") {param.expr()})245 }246 p!(pi: str(",") nl)247 }248 p!(pi: <i str(")"));249 pi250 }251}252impl Printable for ArgsDesc {253 fn print(&self) -> PrintItems {254 let mut pi = p!(new: str("(") >i nl);255 for arg in self.args() {256 if arg.name().is_some() || arg.assign_token().is_some() {257 p!(pi: {arg.name()} str(" = "));258 }259 p!(pi: {arg.expr()} str(",") nl)260 }261 p!(pi: <i str(")"));262 pi263 }264}265impl Printable for SliceDesc {266 fn print(&self) -> PrintItems {267 let mut pi = p!(new: str("["));268 if self.from().is_some() {269 p!(pi: {self.from()});270 }271 p!(pi: str(":"));272 if self.end().is_some() {273 p!(pi: {self.end().map(|e|e.expr())})274 }275 // Keep only one : in case if we don't need step276 if self.step().is_some() {277 p!(pi: str(":") {self.step().map(|e|e.expr())});278 }279 p!(pi: str("]"));280 pi281 }282}283284impl Printable for Member {285 fn print(&self) -> PrintItems {286 match self {287 Member::MemberBindStmt(b) => {288 p!(new: {b.obj_local()})289 }290 Member::MemberAssertStmt(ass) => {291 p!(new: {ass.assertion()})292 }293 Member::MemberFieldNormal(n) => {294 p!(new: {n.field_name()} if(n.plus_token().is_some())({n.plus_token()}) {n.visibility()} str(" ") {n.expr()})295 }296 Member::MemberFieldMethod(m) => {297 p!(new: {m.field_name()} {m.params_desc()} {m.visibility()} str(" ") {m.expr()})298 }299 }300 }301}302303impl Printable for ObjBody {304 fn print(&self) -> PrintItems {305 match self {306 ObjBody::ObjBodyComp(l) => {307 let (children, mut end_comments) = children_between::<Member>(308 l.syntax().clone(),309 l.l_brace_token().map(Into::into).as_ref(),310 Some(311 &(l.comp_specs()312 .next()313 .expect("at least one spec is defined")314 .syntax()315 .clone())316 .into(),317 ),318 None,319 );320 let trailing_for_comp = end_comments.extract_trailing();321 let mut pi = p!(new: str("{") >i nl);322 for mem in children.into_iter() {323 if mem.should_start_with_newline {324 p!(pi: nl);325 }326 p!(pi: items(format_comments(&mem.before_trivia, CommentLocation::AboveItem)));327 p!(pi: {mem.value} str(","));328 p!(pi: items(format_comments(&mem.inline_trivia, CommentLocation::ItemInline)));329 p!(pi: nl)330 }331332 if end_comments.should_start_with_newline {333 p!(pi: nl);334 }335 p!(pi: items(format_comments(&end_comments.trivia, CommentLocation::EndOfItems)));336337 let (compspecs, end_comments) = children_between::<CompSpec>(338 l.syntax().clone(),339 l.member_comps()340 .last()341 .map(|m| m.syntax().clone())342 .map(Into::into)343 .or_else(|| l.l_brace_token().map(Into::into))344 .as_ref(),345 l.r_brace_token().map(Into::into).as_ref(),346 Some(trailing_for_comp),347 );348 for mem in compspecs.into_iter() {349 if mem.should_start_with_newline {350 p!(pi: nl);351 }352 p!(pi: items(format_comments(&mem.before_trivia, CommentLocation::AboveItem)));353 p!(pi: {mem.value});354 p!(pi: items(format_comments(&mem.inline_trivia, CommentLocation::ItemInline)));355 }356 if end_comments.should_start_with_newline {357 p!(pi: nl);358 }359 p!(pi: items(format_comments(&end_comments.trivia, CommentLocation::EndOfItems)));360361 p!(pi: nl <i str("}"));362 pi363 }364 ObjBody::ObjBodyMemberList(l) => {365 let (children, end_comments) = children_between::<Member>(366 l.syntax().clone(),367 l.l_brace_token().map(Into::into).as_ref(),368 l.r_brace_token().map(Into::into).as_ref(),369 None,370 );371 if children.is_empty() && end_comments.is_empty() {372 return p!(new: str("{ }"));373 }374 let mut pi = p!(new: str("{") >i nl);375 for (i, mem) in children.into_iter().enumerate() {376 if mem.should_start_with_newline && i != 0 {377 p!(pi: nl);378 }379 p!(pi: items(format_comments(&mem.before_trivia, CommentLocation::AboveItem)));380 p!(pi: {mem.value} str(","));381 p!(pi: items(format_comments(&mem.inline_trivia, CommentLocation::ItemInline)));382 p!(pi: nl)383 }384385 if end_comments.should_start_with_newline {386 p!(pi: nl);387 }388 p!(pi: items(format_comments(&end_comments.trivia, CommentLocation::EndOfItems)));389 p!(pi: <i str("}"));390 pi391 }392 }393 }394}395impl Printable for UnaryOperator {396 fn print(&self) -> PrintItems {397 p!(new: string(self.text().to_string()))398 }399}400impl Printable for BinaryOperator {401 fn print(&self) -> PrintItems {402 p!(new: string(self.text().to_string()))403 }404}405impl Printable for Bind {406 fn print(&self) -> PrintItems {407 match self {408 Bind::BindDestruct(d) => {409 p!(new: {d.into()} str(" = ") {d.value()})410 }411 Bind::BindFunction(f) => {412 p!(new: {f.name()} {f.params()} str(" = ") {f.value()})413 }414 }415 }416}417impl Printable for Literal {418 fn print(&self) -> PrintItems {419 p!(new: string(self.syntax().to_string()))420 }421}422impl Printable for ImportKind {423 fn print(&self) -> PrintItems {424 p!(new: string(self.syntax().to_string()))425 }426}427impl Printable for ForSpec {428 fn print(&self) -> PrintItems {429 p!(new: str("for ") {self.bind()} str(" in ") {self.expr()})430 }431}432impl Printable for IfSpec {433 fn print(&self) -> PrintItems {434 p!(new: str("if ") {self.expr()})435 }436}437impl Printable for CompSpec {438 fn print(&self) -> PrintItems {439 match self {440 CompSpec::ForSpec(f) => f.print(),441 CompSpec::IfSpec(i) => i.print(),442 }443 }444}445impl Printable for Expr {446 fn print(&self) -> PrintItems {447 let mut o = p!(new:);448 let (stmts, ending) = children_between::<Stmt>(449 self.syntax().clone(),450 None,451 self.expr_base()452 .as_ref()453 .map(ExprBase::syntax)454 .cloned()455 .map(Into::into)456 .as_ref(),457 None,458 );459 for stmt in stmts {460 p!(o: {stmt.value});461 }462 p!(o: {self.expr_base()});463 let (suffixes, ending) = children_between::<Suffix>(464 self.syntax().clone(),465 self.expr_base()466 .as_ref()467 .map(ExprBase::syntax)468 .cloned()469 .map(Into::into)470 .as_ref(),471 None,472 None,473 );474 for suffix in suffixes {475 p!(o: {suffix.value});476 }477 o478 }479}480impl Printable for Suffix {481 fn print(&self) -> PrintItems {482 let mut o = p!(new:);483 match self {484 Suffix::SuffixIndex(i) => {485 if i.question_mark_token().is_some() {486 p!(o: str("?"));487 }488 p!(o: str(".") {i.index()});489 }490 Suffix::SuffixIndexExpr(e) => {491 if e.question_mark_token().is_some() {492 p!(o: str(".?"));493 }494 p!(o: str("[") {e.index()} str("]"))495 }496 Suffix::SuffixSlice(d) => {497 p!(o: {d.slice_desc()})498 }499 Suffix::SuffixApply(a) => {500 p!(o: {a.args_desc()})501 }502 }503 o504 }505}506impl Printable for Stmt {507 fn print(&self) -> PrintItems {508 match self {509 Stmt::StmtLocal(l) => {510 let mut pi = p!(new:);511 let (binds, end_comments) = children_between::<Bind>(512 l.syntax().clone(),513 l.local_kw_token().map(Into::into).as_ref(),514 l.semi_token().map(Into::into).as_ref(),515 None,516 );517 if binds.len() == 1 {518 let bind = &binds[0];519 p!(pi: items(format_comments(&bind.before_trivia, CommentLocation::AboveItem)));520 p!(pi: str("local ") {bind.value});521 // TODO: keep end_comments, child.inline_trivia somehow, force multiple locals formatting in case of presence?522 } else {523 p!(pi: str("local") >i nl);524 for bind in binds {525 if bind.should_start_with_newline {526 p!(pi: nl);527 }528 p!(pi: items(format_comments(&bind.before_trivia, CommentLocation::AboveItem)));529 p!(pi: {bind.value} str(","));530 p!(pi: items(format_comments(&bind.inline_trivia, CommentLocation::ItemInline)) nl);531 }532 if end_comments.should_start_with_newline {533 p!(pi: nl)534 }535 p!(pi: items(format_comments(&end_comments.trivia, CommentLocation::EndOfItems)));536 p!(pi: <i);537 }538 p!(pi: str(";") nl);539 pi540 }541 Stmt::StmtAssert(a) => {542 p!(new: {a.assertion()} str(";") nl)543 }544 }545 }546}547impl Printable for ExprBase {548 fn print(&self) -> PrintItems {549 match self {550 Self::ExprBinary(b) => {551 p!(new: {b.lhs_work()} str(" ") {b.binary_operator()} str(" ") {b.rhs_work()})552 }553 Self::ExprUnary(u) => p!(new: {u.unary_operator()} {u.rhs()}),554 // Self::ExprSlice(s) => {555 // p!(new: {s.expr()} {s.slice_desc()})556 // }557 // Self::ExprIndex(i) => {558 // p!(new: {i.expr()} str(".") {i.index()})559 // }560 // Self::ExprIndexExpr(i) => p!(new: {i.base()} str("[") {i.index()} str("]")),561 // Self::ExprApply(a) => {562 // let mut pi = p!(new: {a.expr()} {a.args_desc()});563 // if a.tailstrict_kw_token().is_some() {564 // p!(pi: str(" tailstrict"));565 // }566 // pi567 // }568 Self::ExprObjExtend(ex) => {569 p!(new: {ex.lhs_work()} str(" ") {ex.rhs_work()})570 }571 Self::ExprParened(p) => {572 p!(new: str("(") {p.expr()} str(")"))573 }574 Self::ExprString(s) => p!(new: {s.text()}),575 Self::ExprNumber(n) => p!(new: {n.number()}),576 Self::ExprArray(a) => {577 let mut pi = p!(new: str("[") >i nl);578 for el in a.exprs() {579 p!(pi: {el} str(",") nl);580 }581 p!(pi: <i str("]"));582 pi583 }584 Self::ExprObject(obj) => {585 p!(new: {obj.obj_body()})586 }587 Self::ExprArrayComp(arr) => {588 let mut pi = p!(new: str("[") {arr.expr()});589 for spec in arr.comp_specs() {590 p!(pi: str(" ") {spec});591 }592 p!(pi: str("]"));593 pi594 }595 Self::ExprImport(v) => {596 p!(new: {v.import_kind()} str(" ") {v.text()})597 }598 Self::ExprVar(n) => p!(new: {n.name()}),599 // Self::ExprLocal(l) => {600 // }601 Self::ExprIfThenElse(ite) => {602 let mut pi =603 p!(new: str("if ") {ite.cond()} str(" then ") {ite.then().map(|t| t.expr())});604 if ite.else_kw_token().is_some() || ite.else_().is_some() {605 p!(pi: str(" else ") {ite.else_().map(|t| t.expr())})606 }607 pi608 }609 Self::ExprFunction(f) => p!(new: str("function") {f.params_desc()} nl {f.expr()}),610 // Self::ExprAssert(a) => p!(new: {a.assertion()} str("; ") {a.expr()}),611 Self::ExprError(e) => p!(new: str("error ") {e.expr()}),612 Self::ExprLiteral(l) => {613 p!(new: {l.literal()})614 }615 }616 }617}618619impl Printable for SourceFile {620 fn print(&self) -> PrintItems {621 let mut pi = p!(new:);622 let before = trivia_before(623 self.syntax().clone(),624 self.expr()625 .map(|e| e.syntax().clone())626 .map(Into::into)627 .as_ref(),628 );629 let after = trivia_after(630 self.syntax().clone(),631 self.expr()632 .map(|e| e.syntax().clone())633 .map(Into::into)634 .as_ref(),635 );636 p!(pi: items(format_comments(&before, CommentLocation::AboveItem)));637 p!(pi: {self.expr()} nl);638 p!(pi: items(format_comments(&after, CommentLocation::EndOfItems)));639 pi640 }641}642643struct FormatOptions {644 // 0 for hard tabs645 indent: u8,646}647fn format(input: &str, opts: &FormatOptions) -> Option<String> {648 let (parsed, errors) = jrsonnet_rowan_parser::parse(input);649 if !errors.is_empty() {650 let mut builder = ass_stroke::SnippetBuilder::new(input);651 for error in errors {652 builder653 .error(ass_stroke::Text::single(654 format!("{:?}", error.error).chars(),655 Default::default(),656 ))657 .range(658 error.range.start().into()659 ..=(usize::from(error.range.end()) - 1).max(error.range.start().into()),660 )661 .build();662 }663 let snippet = builder.build();664 let ansi = ass_stroke::source_to_ansi(&snippet);665 eprintln!("{ansi}");666 // It is possible to recover from this failure, but the output may be broken, as formatter is free to skip667 // ERROR rowan nodes.668 // Recovery needs to be enabled for LSP, though.669 //670 // TODO: Verify how formatter interacts in cases of missing positional values, i.e `if cond then /*missing Expr*/ else residual`.671 return None;672 }673 Some(dprint_core::formatting::format(674 || parsed.print(),675 PrintOptions {676 indent_width: if opts.indent == 0 {677 // Reasonable max length for both 2 and 4 space sized tabs.678 3679 } else {680 opts.indent681 },682 max_width: 100,683 use_tabs: opts.indent == 0,684 new_line_text: "\n",685 },686 ))687}688689#[derive(Parser)]690struct Opts {691 /// Treat input as code, reformat it instead of reading file.692 #[clap(long, short = 'e')]693 exec: bool,694 /// Path to be reformatted if `--exec` if unset, otherwise code itself.695 input: String,696 /// Replace code with formatted in-place, instead of printing it to stdout.697 /// Only applicable if `--exec` is unset.698 #[clap(long, short = 'i')]699 in_place: bool,700701 /// Exit with error if formatted does not match input702 #[arg(long)]703 test: bool,704 /// Number of spaces to indent with705 ///706 /// 0 for guess from input (default), and use hard tabs if unable to guess.707 #[arg(long, default_value = "0")]708 indent: u8,709 /// Force hard tab for indentation710 #[arg(long)]711 hard_tabs: bool,712713 /// Debug option: how many times to call reformatting in case of unstable dprint output resolution.714 ///715 /// 0 for not retrying to reformat.716 #[arg(long, default_value = "0")]717 conv_limit: usize,718}719720#[derive(thiserror::Error, Debug)]721enum Error {722 #[error("--in-place is incompatible with --exec")]723 InPlaceExec,724 #[error("io: {0}")]725 Io(#[from] io::Error),726 #[error("persist: {0}")]727 Persist(#[from] tempfile::PersistError),728 #[error("parsing failed, refusing to reformat corrupted input")]729 ParseError,730}731732fn main_result() -> Result<(), Error> {733 eprintln!("jrsonnet-fmt is a prototype of a jsonnet code formatter, do not expect it to produce meaningful results right now.");734 eprintln!("It is not expected for its output to match other implementations, it will be completly separate implementation with maybe different name.");735 let mut opts = Opts::parse();736 let input = if opts.exec {737 if opts.in_place {738 return Err(Error::InPlaceExec);739 }740 opts.input.clone()741 } else {742 fs::read_to_string(&opts.input)?743 };744745 if opts.indent == 0 {746 // Sane default.747 // TODO: Implement actual guessing.748 opts.hard_tabs = true;749 }750751 let mut iteration = 0;752 let mut formatted = input.clone();753 let mut tmp;754 // https://github.com/dprint/dprint/pull/423755 loop {756 let Some(reformatted) = format(757 &formatted,758 &FormatOptions {759 indent: if opts.indent == 0 || opts.hard_tabs {760 0761 } else {762 opts.indent763 },764 },765 ) else {766 return Err(Error::ParseError);767 };768 tmp = reformatted.trim().to_owned();769 if formatted == tmp {770 break;771 }772 formatted = tmp;773 if opts.conv_limit == 0 {774 break;775 }776 iteration += 1;777 if iteration > opts.conv_limit {778 panic!("formatting not converged");779 }780 }781 formatted.push('\n');782 if opts.test && formatted != input {783 process::exit(1);784 }785 if opts.in_place {786 let path = PathBuf::from(opts.input);787 let mut temp = tempfile::NamedTempFile::new_in(path.parent().expect(788 "not failed during read, this path is not a directory, and there is a parent",789 ))?;790 temp.write_all(formatted.as_bytes())?;791 temp.flush()?;792 temp.persist(&path)?;793 } else {794 print!("{formatted}")795 }796 Ok(())797}798799fn main() {800 if let Err(e) = main_result() {801 eprintln!("{e}");802 process::exit(1);803 }804}cmds/jrsonnet-lsp/src/main.rsdiffbeforeafterboth--- a/cmds/jrsonnet-lsp/src/main.rs
+++ b/cmds/jrsonnet-lsp/src/main.rs
@@ -13,7 +13,7 @@
let mut log = File::create("test").unwrap();
writeln!(log, "start").unwrap();
let (connection, io_threads) = Connection::stdio();
- let capabilities = serde_json::to_value(&ServerCapabilities {
+ let capabilities = serde_json::to_value(ServerCapabilities {
completion_provider: Some(CompletionOptions::default()),
definition_provider: Some(lsp_types::OneOf::Left(true)),
document_link_provider: Some(DocumentLinkOptions {
crates/jrsonnet-rowan-parser/src/generated/syntax_kinds.rsdiffbeforeafterboth--- a/crates/jrsonnet-rowan-parser/src/generated/syntax_kinds.rs
+++ b/crates/jrsonnet-rowan-parser/src/generated/syntax_kinds.rs
@@ -290,4 +290,5 @@
}
#[macro_export]
macro_rules ! T { [||] => { $ crate :: SyntaxKind :: OR } ; [??] => { $ crate :: SyntaxKind :: NULL_COAELSE } ; [&&] => { $ crate :: SyntaxKind :: AND } ; [|] => { $ crate :: SyntaxKind :: BIT_OR } ; [^] => { $ crate :: SyntaxKind :: BIT_XOR } ; [&] => { $ crate :: SyntaxKind :: BIT_AND } ; [==] => { $ crate :: SyntaxKind :: EQ } ; [!=] => { $ crate :: SyntaxKind :: NE } ; [<] => { $ crate :: SyntaxKind :: LT } ; [>] => { $ crate :: SyntaxKind :: GT } ; [<=] => { $ crate :: SyntaxKind :: LE } ; [>=] => { $ crate :: SyntaxKind :: GE } ; [<<] => { $ crate :: SyntaxKind :: LHS } ; [>>] => { $ crate :: SyntaxKind :: RHS } ; [+] => { $ crate :: SyntaxKind :: PLUS } ; [-] => { $ crate :: SyntaxKind :: MINUS } ; [*] => { $ crate :: SyntaxKind :: MUL } ; [/] => { $ crate :: SyntaxKind :: DIV } ; [%] => { $ crate :: SyntaxKind :: MODULO } ; [!] => { $ crate :: SyntaxKind :: NOT } ; [~] => { $ crate :: SyntaxKind :: BIT_NOT } ; ['['] => { $ crate :: SyntaxKind :: L_BRACK } ; [']'] => { $ crate :: SyntaxKind :: R_BRACK } ; ['('] => { $ crate :: SyntaxKind :: L_PAREN } ; [')'] => { $ crate :: SyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: SyntaxKind :: L_BRACE } ; ['}'] => { $ crate :: SyntaxKind :: R_BRACE } ; [:] => { $ crate :: SyntaxKind :: COLON } ; [::] => { $ crate :: SyntaxKind :: COLONCOLON } ; [:::] => { $ crate :: SyntaxKind :: COLONCOLONCOLON } ; [;] => { $ crate :: SyntaxKind :: SEMI } ; [.] => { $ crate :: SyntaxKind :: DOT } ; [...] => { $ crate :: SyntaxKind :: DOTDOTDOT } ; [,] => { $ crate :: SyntaxKind :: COMMA } ; ['$'] => { $ crate :: SyntaxKind :: DOLLAR } ; [=] => { $ crate :: SyntaxKind :: ASSIGN } ; [?] => { $ crate :: SyntaxKind :: QUESTION_MARK } ; [tailstrict] => { $ crate :: SyntaxKind :: TAILSTRICT_KW } ; [local] => { $ crate :: SyntaxKind :: LOCAL_KW } ; [importstr] => { $ crate :: SyntaxKind :: IMPORTSTR_KW } ; [importbin] => { $ crate :: SyntaxKind :: IMPORTBIN_KW } ; [import] => { $ crate :: SyntaxKind :: IMPORT_KW } ; [if] => { $ crate :: SyntaxKind :: IF_KW } ; [then] => { $ crate :: SyntaxKind :: THEN_KW } ; [else] => { $ crate :: SyntaxKind :: ELSE_KW } ; [function] => { $ crate :: SyntaxKind :: FUNCTION_KW } ; [error] => { $ crate :: SyntaxKind :: ERROR_KW } ; [in] => { $ crate :: SyntaxKind :: IN_KW } ; [null] => { $ crate :: SyntaxKind :: NULL_KW } ; [true] => { $ crate :: SyntaxKind :: TRUE_KW } ; [false] => { $ crate :: SyntaxKind :: FALSE_KW } ; [self] => { $ crate :: SyntaxKind :: SELF_KW } ; [super] => { $ crate :: SyntaxKind :: SUPER_KW } ; [for] => { $ crate :: SyntaxKind :: FOR_KW } ; [assert] => { $ crate :: SyntaxKind :: ASSERT_KW } }
+#[allow(unused_imports)]
pub use T;
xtask/src/sourcegen/ast.rsdiffbeforeafterboth--- a/xtask/src/sourcegen/ast.rs
+++ b/xtask/src/sourcegen/ast.rs
@@ -148,7 +148,7 @@
lower_rule(&mut fields, grammar, None, rule, false);
let mut types = HashMap::new();
for field in fields.iter().filter(|f| f.token_name().is_none()) {
- if let Some(old) = types.insert(field.ty(), field.method_name(kinds)) {
+ if let Some(_old) = types.insert(field.ty(), field.method_name(kinds)) {
// panic!("{name}.{} has same type as {name}.{}, resolve conflict by wrapping one field: {}", old, field.method_name(kinds), field.ty());
}
// TODO: check for assignable field types, i.e you can have
xtask/src/sourcegen/mod.rsdiffbeforeafterboth--- a/xtask/src/sourcegen/mod.rs
+++ b/xtask/src/sourcegen/mod.rs
@@ -183,6 +183,7 @@
#[macro_export]
macro_rules! T {#(#t_macros);*}
+ #[allow(unused_imports)]
pub use T;
};