cmakefmt 2.2.0__tar.gz → 2.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/Cargo.lock +37 -37
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/Cargo.toml +4 -4
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/PKG-INFO +1 -1
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/cli/errors.rs +0 -2
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/cli/process.rs +12 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/config/file.rs +66 -23
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/config/legacy.rs +40 -11
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/config/mod.rs +115 -29
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/dprint.rs +198 -5
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/formatter/node.rs +31 -6
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/lib.rs +1 -1
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/main.rs +26 -3
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/spec/mod.rs +10 -3
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/spec/registry.rs +4 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/LICENSE +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/LICENSES/Apache-2.0.txt +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/LICENSES/MIT.txt +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/README.md +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/build.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/pyproject.toml +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/README.md +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/cli/commands.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/cli/diff.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/cli/mod.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/cli/report.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/cli/runtime.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/cli/spec_coverage.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/cli/summary.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/config/editorconfig.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/dump.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/error.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/files.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/formatter/comment.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/formatter/mod.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/lsp/mod.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/parser/ast.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/parser/cursor.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/parser/grammar.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/parser/lower.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/parser/mod.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/parser/scanner.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/semantic.rs +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/spec/builtins.yaml +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/spec/cmake_commands.txt +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/spec/modules.yaml +0 -0
- {cmakefmt-2.2.0 → cmakefmt-2.3.0}/src/wasm.rs +0 -0
|
@@ -19,9 +19,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
|
|
|
19
19
|
|
|
20
20
|
[[package]]
|
|
21
21
|
name = "annotate-snippets"
|
|
22
|
-
version = "0.12.
|
|
22
|
+
version = "0.12.17"
|
|
23
23
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
24
|
-
checksum = "
|
|
24
|
+
checksum = "b2a5b0a5ab8561c603f16c3b78c24a386b1f70e7fc1b1b1e8c15738828e4a176"
|
|
25
25
|
dependencies = [
|
|
26
26
|
"anstyle",
|
|
27
27
|
"memchr",
|
|
@@ -205,9 +205,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
|
|
205
205
|
|
|
206
206
|
[[package]]
|
|
207
207
|
name = "cc"
|
|
208
|
-
version = "1.
|
|
208
|
+
version = "1.10.0"
|
|
209
209
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
210
|
-
checksum = "
|
|
210
|
+
checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0"
|
|
211
211
|
dependencies = [
|
|
212
212
|
"find-msvc-tools",
|
|
213
213
|
"shlex",
|
|
@@ -324,7 +324,7 @@ dependencies = [
|
|
|
324
324
|
|
|
325
325
|
[[package]]
|
|
326
326
|
name = "cmakefmt-rust"
|
|
327
|
-
version = "2.
|
|
327
|
+
version = "2.3.0"
|
|
328
328
|
dependencies = [
|
|
329
329
|
"clap",
|
|
330
330
|
"clap_complete",
|
|
@@ -361,9 +361,9 @@ dependencies = [
|
|
|
361
361
|
|
|
362
362
|
[[package]]
|
|
363
363
|
name = "codspeed"
|
|
364
|
-
version = "5.0.
|
|
364
|
+
version = "5.0.3"
|
|
365
365
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
366
|
-
checksum = "
|
|
366
|
+
checksum = "1cade51e6e6e30e7ea2cd9599fa5d5d5f48255a6b221bbd0cab1cf32f3c23c65"
|
|
367
367
|
dependencies = [
|
|
368
368
|
"anyhow",
|
|
369
369
|
"cc",
|
|
@@ -379,9 +379,9 @@ dependencies = [
|
|
|
379
379
|
|
|
380
380
|
[[package]]
|
|
381
381
|
name = "codspeed-criterion-compat"
|
|
382
|
-
version = "5.0.
|
|
382
|
+
version = "5.0.3"
|
|
383
383
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
384
|
-
checksum = "
|
|
384
|
+
checksum = "b5d1640d31b122c8d754939c6ae4040709a9602f289d11e43075476a21285020"
|
|
385
385
|
dependencies = [
|
|
386
386
|
"clap",
|
|
387
387
|
"codspeed",
|
|
@@ -392,9 +392,9 @@ dependencies = [
|
|
|
392
392
|
|
|
393
393
|
[[package]]
|
|
394
394
|
name = "codspeed-criterion-compat-walltime"
|
|
395
|
-
version = "5.0.
|
|
395
|
+
version = "5.0.3"
|
|
396
396
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
397
|
-
checksum = "
|
|
397
|
+
checksum = "2a83eed387b8f84aad4cb29607758bec3ab3f53b1734af934ddae7fee626d8ce"
|
|
398
398
|
dependencies = [
|
|
399
399
|
"anes",
|
|
400
400
|
"cast",
|
|
@@ -534,9 +534,9 @@ dependencies = [
|
|
|
534
534
|
|
|
535
535
|
[[package]]
|
|
536
536
|
name = "dprint-core"
|
|
537
|
-
version = "0.
|
|
537
|
+
version = "0.71.1"
|
|
538
538
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
539
|
-
checksum = "
|
|
539
|
+
checksum = "670d3c17cf65d37f5324b4fc198993148beb8c44e56fa4fe3676dd3c033d4e8c"
|
|
540
540
|
dependencies = [
|
|
541
541
|
"indexmap",
|
|
542
542
|
"serde",
|
|
@@ -593,9 +593,9 @@ dependencies = [
|
|
|
593
593
|
|
|
594
594
|
[[package]]
|
|
595
595
|
name = "equivalent"
|
|
596
|
-
version = "1.0.
|
|
596
|
+
version = "1.0.3"
|
|
597
597
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
598
|
-
checksum = "
|
|
598
|
+
checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
|
|
599
599
|
|
|
600
600
|
[[package]]
|
|
601
601
|
name = "errno"
|
|
@@ -615,9 +615,9 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
|
|
|
615
615
|
|
|
616
616
|
[[package]]
|
|
617
617
|
name = "find-msvc-tools"
|
|
618
|
-
version = "0.1.
|
|
618
|
+
version = "0.1.15"
|
|
619
619
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
620
|
-
checksum = "
|
|
620
|
+
checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
|
|
621
621
|
|
|
622
622
|
[[package]]
|
|
623
623
|
name = "fluent-uri"
|
|
@@ -706,9 +706,9 @@ dependencies = [
|
|
|
706
706
|
|
|
707
707
|
[[package]]
|
|
708
708
|
name = "granit-parser"
|
|
709
|
-
version = "
|
|
709
|
+
version = "2.0.0"
|
|
710
710
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
711
|
-
checksum = "
|
|
711
|
+
checksum = "da55feca5d1625466bae068f9fd4b87892caeae70c3fe671ddb0f50d41aebf37"
|
|
712
712
|
dependencies = [
|
|
713
713
|
"arraydeque",
|
|
714
714
|
"smallvec",
|
|
@@ -881,9 +881,9 @@ dependencies = [
|
|
|
881
881
|
|
|
882
882
|
[[package]]
|
|
883
883
|
name = "libc"
|
|
884
|
-
version = "0.2.
|
|
884
|
+
version = "0.2.191"
|
|
885
885
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
886
|
-
checksum = "
|
|
886
|
+
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
|
887
887
|
|
|
888
888
|
[[package]]
|
|
889
889
|
name = "linux-raw-sys"
|
|
@@ -1048,9 +1048,9 @@ checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
|
|
|
1048
1048
|
|
|
1049
1049
|
[[package]]
|
|
1050
1050
|
name = "pest"
|
|
1051
|
-
version = "2.9.
|
|
1051
|
+
version = "2.9.4"
|
|
1052
1052
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1053
|
-
checksum = "
|
|
1053
|
+
checksum = "fd47a460a9cbc3b3429c7e22bf0d76653e779319bae45a499ca010c9a990bb23"
|
|
1054
1054
|
dependencies = [
|
|
1055
1055
|
"memchr",
|
|
1056
1056
|
"psm",
|
|
@@ -1060,9 +1060,9 @@ dependencies = [
|
|
|
1060
1060
|
|
|
1061
1061
|
[[package]]
|
|
1062
1062
|
name = "pest_derive"
|
|
1063
|
-
version = "2.9.
|
|
1063
|
+
version = "2.9.4"
|
|
1064
1064
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1065
|
-
checksum = "
|
|
1065
|
+
checksum = "203e46697708f7519ab1608393cf89239cafb46b8e6d08a8ffe359359b11ef44"
|
|
1066
1066
|
dependencies = [
|
|
1067
1067
|
"pest",
|
|
1068
1068
|
"pest_generator",
|
|
@@ -1070,9 +1070,9 @@ dependencies = [
|
|
|
1070
1070
|
|
|
1071
1071
|
[[package]]
|
|
1072
1072
|
name = "pest_generator"
|
|
1073
|
-
version = "2.9.
|
|
1073
|
+
version = "2.9.4"
|
|
1074
1074
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1075
|
-
checksum = "
|
|
1075
|
+
checksum = "e84ae6340a458d3d6cfc73cf328cf3cfe90b2484cd0de25eb66aa954615ed4d5"
|
|
1076
1076
|
dependencies = [
|
|
1077
1077
|
"pest",
|
|
1078
1078
|
"pest_meta",
|
|
@@ -1083,9 +1083,9 @@ dependencies = [
|
|
|
1083
1083
|
|
|
1084
1084
|
[[package]]
|
|
1085
1085
|
name = "pest_meta"
|
|
1086
|
-
version = "2.9.
|
|
1086
|
+
version = "2.9.4"
|
|
1087
1087
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1088
|
-
checksum = "
|
|
1088
|
+
checksum = "b57f92f32b3dbce6598fd8f5cdf1f06a6072570b8103fa21728fa9036923e710"
|
|
1089
1089
|
dependencies = [
|
|
1090
1090
|
"pest",
|
|
1091
1091
|
]
|
|
@@ -1400,9 +1400,9 @@ dependencies = [
|
|
|
1400
1400
|
|
|
1401
1401
|
[[package]]
|
|
1402
1402
|
name = "serde-saphyr"
|
|
1403
|
-
version = "
|
|
1403
|
+
version = "2.0.0"
|
|
1404
1404
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1405
|
-
checksum = "
|
|
1405
|
+
checksum = "a253edfdea34032da21af84e16fcc94f4c7a6ba237f9f3bc2dbf43cea8535c44"
|
|
1406
1406
|
dependencies = [
|
|
1407
1407
|
"annotate-snippets",
|
|
1408
1408
|
"base64",
|
|
@@ -1516,9 +1516,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
|
|
1516
1516
|
|
|
1517
1517
|
[[package]]
|
|
1518
1518
|
name = "smallvec"
|
|
1519
|
-
version = "1.16.
|
|
1519
|
+
version = "1.16.4"
|
|
1520
1520
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1521
|
-
checksum = "
|
|
1521
|
+
checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8"
|
|
1522
1522
|
|
|
1523
1523
|
[[package]]
|
|
1524
1524
|
name = "stacker"
|
|
@@ -1900,18 +1900,18 @@ dependencies = [
|
|
|
1900
1900
|
|
|
1901
1901
|
[[package]]
|
|
1902
1902
|
name = "zerocopy"
|
|
1903
|
-
version = "0.8.
|
|
1903
|
+
version = "0.8.63"
|
|
1904
1904
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1905
|
-
checksum = "
|
|
1905
|
+
checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8"
|
|
1906
1906
|
dependencies = [
|
|
1907
1907
|
"zerocopy-derive",
|
|
1908
1908
|
]
|
|
1909
1909
|
|
|
1910
1910
|
[[package]]
|
|
1911
1911
|
name = "zerocopy-derive"
|
|
1912
|
-
version = "0.8.
|
|
1912
|
+
version = "0.8.63"
|
|
1913
1913
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1914
|
-
checksum = "
|
|
1914
|
+
checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f"
|
|
1915
1915
|
dependencies = [
|
|
1916
1916
|
"proc-macro2",
|
|
1917
1917
|
"quote",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "cmakefmt-rust"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.3.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
description = "A fast, correct CMake formatter"
|
|
6
6
|
license = "MIT OR Apache-2.0"
|
|
@@ -58,7 +58,7 @@ cli = [
|
|
|
58
58
|
[dependencies]
|
|
59
59
|
serde = { version = "1", features = ["derive"] }
|
|
60
60
|
serde_json = { version = "1", features = ["preserve_order"] }
|
|
61
|
-
serde-saphyr = "
|
|
61
|
+
serde-saphyr = "2.0"
|
|
62
62
|
toml = "1.1.2"
|
|
63
63
|
thiserror = "2.0.19"
|
|
64
64
|
indexmap = { version = "2.13", features = ["serde"] }
|
|
@@ -80,13 +80,13 @@ ctrlc = { version = "3", optional = true }
|
|
|
80
80
|
schemars = { version = "^1.2", optional = true }
|
|
81
81
|
lsp-server = { version = "0.10", optional = true }
|
|
82
82
|
lsp-types = { version = "0.97", optional = true }
|
|
83
|
-
dprint-core = { version = "0.
|
|
83
|
+
dprint-core = { version = "0.71.0", default-features = false, features = ["wasm"], optional = true }
|
|
84
84
|
|
|
85
85
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
86
86
|
wasm-bindgen = { version = "0.2", optional = true }
|
|
87
87
|
|
|
88
88
|
[build-dependencies]
|
|
89
|
-
serde-saphyr = "
|
|
89
|
+
serde-saphyr = "2.0"
|
|
90
90
|
serde_json = { version = "1", features = ["preserve_order"] }
|
|
91
91
|
rmp-serde = "1"
|
|
92
92
|
|
|
@@ -429,8 +429,6 @@ fn renamed_config_key(key: &str) -> Option<&'static str> {
|
|
|
429
429
|
"max_subgroups_hwrap" => Some("max_hanging_wrap_groups"),
|
|
430
430
|
"min_prefix_chars" => Some("min_prefix_length"),
|
|
431
431
|
"max_prefix_chars" => Some("max_prefix_length"),
|
|
432
|
-
"separate_ctrl_name_with_space" => Some("space_before_control_paren"),
|
|
433
|
-
"separate_fn_name_with_space" => Some("space_before_definition_paren"),
|
|
434
432
|
_ => None,
|
|
435
433
|
}
|
|
436
434
|
}
|
|
@@ -1064,6 +1064,12 @@ pub(crate) fn build_context(
|
|
|
1064
1064
|
if let Some(v) = cli.config_overrides.keyword_case {
|
|
1065
1065
|
config.keyword_case = v;
|
|
1066
1066
|
}
|
|
1067
|
+
if let Some(v) = cli.config_overrides.separate_fn_name_with_space {
|
|
1068
|
+
config.separate_fn_name_with_space = v;
|
|
1069
|
+
}
|
|
1070
|
+
if let Some(v) = cli.config_overrides.separate_ctrl_name_with_space {
|
|
1071
|
+
config.separate_ctrl_name_with_space = v;
|
|
1072
|
+
}
|
|
1067
1073
|
if let Some(v) = cli.config_overrides.dangle_parens {
|
|
1068
1074
|
config.dangle_parens = v;
|
|
1069
1075
|
}
|
|
@@ -1143,6 +1149,12 @@ pub(crate) fn describe_cli_overrides(cli: &Cli) -> String {
|
|
|
1143
1149
|
if let Some(keyword_case) = cli.config_overrides.keyword_case {
|
|
1144
1150
|
parts.push(format!("keyword_case={keyword_case:?}"));
|
|
1145
1151
|
}
|
|
1152
|
+
if let Some(value) = cli.config_overrides.separate_fn_name_with_space {
|
|
1153
|
+
parts.push(format!("separate_fn_name_with_space={value}"));
|
|
1154
|
+
}
|
|
1155
|
+
if let Some(value) = cli.config_overrides.separate_ctrl_name_with_space {
|
|
1156
|
+
parts.push(format!("separate_ctrl_name_with_space={value}"));
|
|
1157
|
+
}
|
|
1146
1158
|
if let Some(dangle_parens) = cli.config_overrides.dangle_parens {
|
|
1147
1159
|
parts.push(format!("dangle_parens={dangle_parens}"));
|
|
1148
1160
|
}
|
|
@@ -13,7 +13,7 @@ use serde::Serialize;
|
|
|
13
13
|
|
|
14
14
|
use crate::config::{
|
|
15
15
|
ArgumentCommentStyle, CaseStyle, Config, ContinuationAlign, DangleAlign, FractionalTabPolicy,
|
|
16
|
-
LineEnding, PerCommandConfig,
|
|
16
|
+
LineEnding, PerCommandConfig, WrapAfterFirstArgAlign,
|
|
17
17
|
};
|
|
18
18
|
use crate::error::{Error, IoResultExt, Result};
|
|
19
19
|
|
|
@@ -79,6 +79,8 @@ struct FormatSection {
|
|
|
79
79
|
require_valid_layout: Option<bool>,
|
|
80
80
|
/// Keep the first positional argument on the command line when wrapping.
|
|
81
81
|
wrap_after_first_arg: Option<bool>,
|
|
82
|
+
/// Where a `wrap_after_first_arg` continuation starts: `under-first-arg` or `default-indent`.
|
|
83
|
+
wrap_after_first_arg_align: Option<WrapAfterFirstArgAlign>,
|
|
82
84
|
/// How to indent continuation lines: `same-indent` or `under-first-value`.
|
|
83
85
|
continuation_align: Option<ContinuationAlign>,
|
|
84
86
|
/// Sort arguments in keyword sections marked `sortable` in the command spec.
|
|
@@ -95,10 +97,14 @@ struct FormatSection {
|
|
|
95
97
|
min_prefix_length: Option<usize>,
|
|
96
98
|
/// Upper heuristic bound used when deciding between compact and wrapped layouts. Default: `10`.
|
|
97
99
|
max_prefix_length: Option<usize>,
|
|
98
|
-
/// Insert a space before `(` for
|
|
99
|
-
space_before_control_paren
|
|
100
|
-
|
|
100
|
+
/// Insert a space before `(` for structural commands, including function/macro definitions.
|
|
101
|
+
#[serde(alias = "space_before_control_paren")]
|
|
102
|
+
separate_ctrl_name_with_space: Option<bool>,
|
|
103
|
+
/// Deprecated fallback for structural-command spacing. An explicit control setting takes precedence.
|
|
104
|
+
#[cfg_attr(feature = "cli", schemars(extend("deprecated" = true)))]
|
|
101
105
|
space_before_definition_paren: Option<bool>,
|
|
106
|
+
/// Insert a space before `(` for ordinary commands and custom function calls.
|
|
107
|
+
separate_fn_name_with_space: Option<bool>,
|
|
102
108
|
/// Output casing for command names: `lower`, `upper`, or `unchanged`.
|
|
103
109
|
command_case: Option<CaseStyle>,
|
|
104
110
|
/// Output casing for recognized keywords and flags: `lower`, `upper`, or `unchanged`.
|
|
@@ -207,7 +213,27 @@ pub fn default_config_template() -> String {
|
|
|
207
213
|
/// The output is a pretty-printed JSON string suitable for publishing to
|
|
208
214
|
/// `cmakefmt.dev/schemas/v{version}/schema.json`.
|
|
209
215
|
pub fn generate_json_schema() -> String {
|
|
210
|
-
let schema = schemars::schema_for!(FileConfig);
|
|
216
|
+
let mut schema = schemars::schema_for!(FileConfig);
|
|
217
|
+
// Schemars omits serde input aliases. Keep the released alias valid in
|
|
218
|
+
// editors while configuration dumps use the canonical name.
|
|
219
|
+
if let Some(properties) = schema
|
|
220
|
+
.get_mut("$defs")
|
|
221
|
+
.and_then(|defs| defs.pointer_mut("/FormatSection/properties"))
|
|
222
|
+
.and_then(serde_json::Value::as_object_mut)
|
|
223
|
+
{
|
|
224
|
+
if let Some(mut alias) = properties.get("separate_ctrl_name_with_space").cloned() {
|
|
225
|
+
if let Some(object) = alias.as_object_mut() {
|
|
226
|
+
object.insert("deprecated".into(), serde_json::json!(true));
|
|
227
|
+
object.insert(
|
|
228
|
+
"description".into(),
|
|
229
|
+
serde_json::json!(
|
|
230
|
+
"Deprecated input alias for `separate_ctrl_name_with_space`."
|
|
231
|
+
),
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
properties.insert("space_before_control_paren".into(), alias);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
211
237
|
serde_json::to_string_pretty(&schema).expect("JSON schema serialization failed")
|
|
212
238
|
}
|
|
213
239
|
|
|
@@ -247,6 +273,10 @@ fn default_config_template_toml() -> String {
|
|
|
247
273
|
"# require_valid_layout = true\n\n",
|
|
248
274
|
"# Keep the first positional argument on the command line when wrapping.\n",
|
|
249
275
|
"# wrap_after_first_arg = true\n\n",
|
|
276
|
+
"# Where a wrap_after_first_arg continuation starts: under-first-arg\n",
|
|
277
|
+
"# (default, aligned past the opening paren) or default-indent (one\n",
|
|
278
|
+
"# indentation level in from the command, as in the vertical layout).\n",
|
|
279
|
+
"# wrap_after_first_arg_align = \"default-indent\"\n\n",
|
|
250
280
|
"# Continuation-line alignment when a wrapped keyword section overflows\n",
|
|
251
281
|
"# line_width: under-first-value (default, cmake-format hanging-indent) or\n",
|
|
252
282
|
"# same-indent (wrap at the keyword's own indent).\n",
|
|
@@ -265,10 +295,10 @@ fn default_config_template_toml() -> String {
|
|
|
265
295
|
"min_prefix_length = {min_prefix_chars}\n\n",
|
|
266
296
|
"# Upper heuristic bound used when deciding between compact and wrapped layouts.\n",
|
|
267
297
|
"max_prefix_length = {max_prefix_chars}\n\n",
|
|
268
|
-
"# Insert a space before '(' for
|
|
269
|
-
"#
|
|
270
|
-
"# Insert a space before '(' for
|
|
271
|
-
"#
|
|
298
|
+
"# Insert a space before '(' for structural commands, including function/macro definitions.\n",
|
|
299
|
+
"# separate_ctrl_name_with_space = true\n\n",
|
|
300
|
+
"# Insert a space before '(' for ordinary command and custom function calls.\n",
|
|
301
|
+
"# separate_fn_name_with_space = true\n\n",
|
|
272
302
|
"# Output casing for command names: lower, upper, or unchanged.\n",
|
|
273
303
|
"command_case = \"{command_case}\"\n\n",
|
|
274
304
|
"# Output casing for recognized keywords and flags: lower, upper, or unchanged.\n",
|
|
@@ -380,6 +410,7 @@ struct EffectiveFormatSection {
|
|
|
380
410
|
require_valid_layout: bool,
|
|
381
411
|
#[serde(skip_serializing_if = "std::ops::Not::not")]
|
|
382
412
|
wrap_after_first_arg: bool,
|
|
413
|
+
wrap_after_first_arg_align: WrapAfterFirstArgAlign,
|
|
383
414
|
continuation_align: ContinuationAlign,
|
|
384
415
|
#[serde(skip_serializing_if = "std::ops::Not::not")]
|
|
385
416
|
enable_sort: bool,
|
|
@@ -390,8 +421,8 @@ struct EffectiveFormatSection {
|
|
|
390
421
|
dangle_align: DangleAlign,
|
|
391
422
|
min_prefix_length: usize,
|
|
392
423
|
max_prefix_length: usize,
|
|
393
|
-
|
|
394
|
-
|
|
424
|
+
separate_ctrl_name_with_space: bool,
|
|
425
|
+
separate_fn_name_with_space: bool,
|
|
395
426
|
command_case: CaseStyle,
|
|
396
427
|
keyword_case: CaseStyle,
|
|
397
428
|
}
|
|
@@ -429,6 +460,7 @@ impl From<&Config> for EffectiveConfigFile {
|
|
|
429
460
|
always_wrap: config.always_wrap.clone(),
|
|
430
461
|
require_valid_layout: config.require_valid_layout,
|
|
431
462
|
wrap_after_first_arg: config.wrap_after_first_arg,
|
|
463
|
+
wrap_after_first_arg_align: config.wrap_after_first_arg_align,
|
|
432
464
|
continuation_align: config.continuation_align,
|
|
433
465
|
enable_sort: config.enable_sort,
|
|
434
466
|
autosort: config.autosort,
|
|
@@ -437,8 +469,8 @@ impl From<&Config> for EffectiveConfigFile {
|
|
|
437
469
|
dangle_align: config.dangle_align,
|
|
438
470
|
min_prefix_length: config.min_prefix_chars,
|
|
439
471
|
max_prefix_length: config.max_prefix_chars,
|
|
440
|
-
|
|
441
|
-
|
|
472
|
+
separate_ctrl_name_with_space: config.separate_ctrl_name_with_space,
|
|
473
|
+
separate_fn_name_with_space: config.separate_fn_name_with_space,
|
|
442
474
|
command_case: config.command_case,
|
|
443
475
|
keyword_case: config.keyword_case,
|
|
444
476
|
},
|
|
@@ -495,6 +527,10 @@ fn default_config_template_yaml() -> String {
|
|
|
495
527
|
" # require_valid_layout: true\n\n",
|
|
496
528
|
" # Keep the first positional argument on the command line when wrapping.\n",
|
|
497
529
|
" # wrap_after_first_arg: true\n\n",
|
|
530
|
+
" # Where a wrap_after_first_arg continuation starts: under-first-arg\n",
|
|
531
|
+
" # (default, aligned past the opening parenthesis) or default-indent (one\n",
|
|
532
|
+
" # indentation level in from the command, as in the vertical layout).\n",
|
|
533
|
+
" # wrap_after_first_arg_align: default-indent\n\n",
|
|
498
534
|
" # Continuation-line alignment when a wrapped keyword section overflows\n",
|
|
499
535
|
" # line_width: under-first-value (default, cmake-format hanging-indent) or\n",
|
|
500
536
|
" # same-indent (wrap at the keyword's own indent).\n",
|
|
@@ -513,10 +549,10 @@ fn default_config_template_yaml() -> String {
|
|
|
513
549
|
" min_prefix_length: {min_prefix_chars}\n\n",
|
|
514
550
|
" # Upper heuristic bound used when deciding between compact and wrapped layouts.\n",
|
|
515
551
|
" max_prefix_length: {max_prefix_chars}\n\n",
|
|
516
|
-
" # Insert a space before '(' for
|
|
517
|
-
" #
|
|
518
|
-
" # Insert a space before '(' for
|
|
519
|
-
" #
|
|
552
|
+
" # Insert a space before '(' for structural commands, including function/macro definitions.\n",
|
|
553
|
+
" # separate_ctrl_name_with_space: true\n\n",
|
|
554
|
+
" # Insert a space before '(' for ordinary command and custom function calls.\n",
|
|
555
|
+
" # separate_fn_name_with_space: true\n\n",
|
|
520
556
|
" # Output casing for command names: lower, upper, or unchanged.\n",
|
|
521
557
|
" command_case: {command_case}\n\n",
|
|
522
558
|
" # Output casing for recognized keywords and flags: lower, upper, or unchanged.\n",
|
|
@@ -725,6 +761,9 @@ impl Config {
|
|
|
725
761
|
if let Some(v) = fc.format.wrap_after_first_arg {
|
|
726
762
|
self.wrap_after_first_arg = v;
|
|
727
763
|
}
|
|
764
|
+
if let Some(v) = fc.format.wrap_after_first_arg_align {
|
|
765
|
+
self.wrap_after_first_arg_align = v;
|
|
766
|
+
}
|
|
728
767
|
if let Some(v) = fc.format.continuation_align {
|
|
729
768
|
self.continuation_align = v;
|
|
730
769
|
}
|
|
@@ -749,10 +788,14 @@ impl Config {
|
|
|
749
788
|
if let Some(v) = fc.format.max_prefix_length {
|
|
750
789
|
self.max_prefix_chars = v;
|
|
751
790
|
}
|
|
752
|
-
if let Some(v) = fc
|
|
791
|
+
if let Some(v) = fc
|
|
792
|
+
.format
|
|
793
|
+
.separate_ctrl_name_with_space
|
|
794
|
+
.or(fc.format.space_before_definition_paren)
|
|
795
|
+
{
|
|
753
796
|
self.separate_ctrl_name_with_space = v;
|
|
754
797
|
}
|
|
755
|
-
if let Some(v) = fc.format.
|
|
798
|
+
if let Some(v) = fc.format.separate_fn_name_with_space {
|
|
756
799
|
self.separate_fn_name_with_space = v;
|
|
757
800
|
}
|
|
758
801
|
if let Some(v) = fc.format.command_case {
|
|
@@ -1024,8 +1067,8 @@ use_tabs = true
|
|
|
1024
1067
|
max_empty_lines = 2
|
|
1025
1068
|
dangle_parens = true
|
|
1026
1069
|
dangle_align = "open"
|
|
1027
|
-
|
|
1028
|
-
|
|
1070
|
+
separate_ctrl_name_with_space = true
|
|
1071
|
+
separate_fn_name_with_space = true
|
|
1029
1072
|
max_hanging_wrap_positional_args = 3
|
|
1030
1073
|
max_hanging_wrap_groups = 1
|
|
1031
1074
|
command_case = "upper"
|
|
@@ -1285,8 +1328,8 @@ format:
|
|
|
1285
1328
|
dangle_align: open
|
|
1286
1329
|
min_prefix_length: 2
|
|
1287
1330
|
max_prefix_length: 12
|
|
1288
|
-
|
|
1289
|
-
|
|
1331
|
+
separate_ctrl_name_with_space: true
|
|
1332
|
+
separate_fn_name_with_space: true
|
|
1290
1333
|
command_case: unchanged
|
|
1291
1334
|
keyword_case: lower
|
|
1292
1335
|
markup:
|
|
@@ -16,7 +16,7 @@ use serde::{Deserialize, Deserializer, Serialize};
|
|
|
16
16
|
|
|
17
17
|
use crate::config::{
|
|
18
18
|
file::DumpConfigFormat, CaseStyle, ContinuationAlign, DangleAlign, FractionalTabPolicy,
|
|
19
|
-
LineEnding, PerCommandConfig,
|
|
19
|
+
LineEnding, PerCommandConfig, WrapAfterFirstArgAlign,
|
|
20
20
|
};
|
|
21
21
|
use crate::error::{Error, IoResultExt, Result};
|
|
22
22
|
use crate::spec::{
|
|
@@ -217,7 +217,7 @@ fn parse_legacy_config(path: &Path, source: &str) -> Result<BTreeMap<String, Leg
|
|
|
217
217
|
// Retain non-finite scalars as strings so unsupported options
|
|
218
218
|
// can still be skipped. Only legacy conversion is permissive;
|
|
219
219
|
// ordinary configuration parsing keeps the default policy.
|
|
220
|
-
|
|
220
|
+
non_finite_float_policy: serde_saphyr::NonFiniteFloatPolicy::AsString,
|
|
221
221
|
},
|
|
222
222
|
)
|
|
223
223
|
.map_err(|err| Error::LegacyMigration {
|
|
@@ -761,9 +761,9 @@ struct OutputFormatSection {
|
|
|
761
761
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
762
762
|
max_prefix_length: Option<usize>,
|
|
763
763
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
764
|
-
|
|
764
|
+
separate_ctrl_name_with_space: Option<bool>,
|
|
765
765
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
766
|
-
|
|
766
|
+
separate_fn_name_with_space: Option<bool>,
|
|
767
767
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
768
768
|
command_case: Option<CaseStyle>,
|
|
769
769
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
@@ -775,6 +775,8 @@ struct OutputFormatSection {
|
|
|
775
775
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
776
776
|
wrap_after_first_arg: Option<bool>,
|
|
777
777
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
778
|
+
wrap_after_first_arg_align: Option<WrapAfterFirstArgAlign>,
|
|
779
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
778
780
|
continuation_align: Option<ContinuationAlign>,
|
|
779
781
|
}
|
|
780
782
|
|
|
@@ -797,13 +799,14 @@ impl OutputFormatSection {
|
|
|
797
799
|
|| self.dangle_align.is_some()
|
|
798
800
|
|| self.min_prefix_length.is_some()
|
|
799
801
|
|| self.max_prefix_length.is_some()
|
|
800
|
-
|| self.
|
|
801
|
-
|| self.
|
|
802
|
+
|| self.separate_ctrl_name_with_space.is_some()
|
|
803
|
+
|| self.separate_fn_name_with_space.is_some()
|
|
802
804
|
|| self.command_case.is_some()
|
|
803
805
|
|| self.keyword_case.is_some()
|
|
804
806
|
|| self.enable_sort.is_some()
|
|
805
807
|
|| self.autosort.is_some()
|
|
806
808
|
|| self.wrap_after_first_arg.is_some()
|
|
809
|
+
|| self.wrap_after_first_arg_align.is_some()
|
|
807
810
|
|| self.continuation_align.is_some()
|
|
808
811
|
}
|
|
809
812
|
}
|
|
@@ -935,10 +938,21 @@ fn merge_format_section(converted: &mut ConvertedConfig, path: &Path, value: &Le
|
|
|
935
938
|
converted.format.max_prefix_length = as_usize(value)
|
|
936
939
|
}
|
|
937
940
|
"separate_ctrl_name_with_space" | "space_before_control_paren" => {
|
|
938
|
-
converted.format.
|
|
941
|
+
converted.format.separate_ctrl_name_with_space = as_bool(value)
|
|
942
|
+
}
|
|
943
|
+
"space_before_definition_paren" => {
|
|
944
|
+
if !table.contains_key("separate_ctrl_name_with_space")
|
|
945
|
+
&& !table.contains_key("space_before_control_paren")
|
|
946
|
+
{
|
|
947
|
+
converted.format.separate_ctrl_name_with_space = as_bool(value);
|
|
948
|
+
}
|
|
949
|
+
converted.notes.push(format!(
|
|
950
|
+
"{}: space_before_definition_paren is a fallback for separate_ctrl_name_with_space; this also affects other structural commands, and an explicit control setting takes precedence",
|
|
951
|
+
path.display()
|
|
952
|
+
));
|
|
939
953
|
}
|
|
940
|
-
"separate_fn_name_with_space"
|
|
941
|
-
converted.format.
|
|
954
|
+
"separate_fn_name_with_space" => {
|
|
955
|
+
converted.format.separate_fn_name_with_space = as_bool(value)
|
|
942
956
|
}
|
|
943
957
|
"command_case" => {
|
|
944
958
|
converted.format.command_case = convert_case_style(path, converted, key, value)
|
|
@@ -949,6 +963,9 @@ fn merge_format_section(converted: &mut ConvertedConfig, path: &Path, value: &Le
|
|
|
949
963
|
"enable_sort" => converted.format.enable_sort = as_bool(value),
|
|
950
964
|
"autosort" => converted.format.autosort = as_bool(value),
|
|
951
965
|
"wrap_after_first_arg" => converted.format.wrap_after_first_arg = as_bool(value),
|
|
966
|
+
"wrap_after_first_arg_align" => {
|
|
967
|
+
converted.format.wrap_after_first_arg_align = as_wrap_after_first_arg_align(value)
|
|
968
|
+
}
|
|
952
969
|
"continuation_align" => {
|
|
953
970
|
converted.format.continuation_align = as_continuation_align(value)
|
|
954
971
|
}
|
|
@@ -1205,6 +1222,9 @@ fn convert_layout_overrides(value: &LegacyValue) -> Option<LayoutOverridesOverri
|
|
|
1205
1222
|
"always_wrap" => layout.always_wrap = as_bool(value),
|
|
1206
1223
|
"max_pargs_hwrap" => layout.max_pargs_hwrap = as_usize(value),
|
|
1207
1224
|
"wrap_after_first_arg" => layout.wrap_after_first_arg = as_bool(value),
|
|
1225
|
+
"wrap_after_first_arg_align" => {
|
|
1226
|
+
layout.wrap_after_first_arg_align = as_wrap_after_first_arg_align(value)
|
|
1227
|
+
}
|
|
1208
1228
|
"continuation_align" => layout.continuation_align = as_continuation_align(value),
|
|
1209
1229
|
_ => {}
|
|
1210
1230
|
}
|
|
@@ -1304,6 +1324,14 @@ fn as_dangle_align(value: &LegacyValue) -> Option<DangleAlign> {
|
|
|
1304
1324
|
}
|
|
1305
1325
|
}
|
|
1306
1326
|
|
|
1327
|
+
fn as_wrap_after_first_arg_align(value: &LegacyValue) -> Option<WrapAfterFirstArgAlign> {
|
|
1328
|
+
match value.as_str()?.to_ascii_lowercase().as_str() {
|
|
1329
|
+
"default-indent" => Some(WrapAfterFirstArgAlign::DefaultIndent),
|
|
1330
|
+
"under-first-arg" => Some(WrapAfterFirstArgAlign::UnderFirstArg),
|
|
1331
|
+
_ => None,
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1307
1335
|
fn as_continuation_align(value: &LegacyValue) -> Option<ContinuationAlign> {
|
|
1308
1336
|
match value.as_str()?.to_ascii_lowercase().as_str() {
|
|
1309
1337
|
"same-indent" => Some(ContinuationAlign::SameIndent),
|
|
@@ -1994,7 +2022,8 @@ misc:
|
|
|
1994
2022
|
std::fs::write(&path, "format:\n separate_ctrl_name_with_space: true\n").unwrap();
|
|
1995
2023
|
|
|
1996
2024
|
let converted = convert_legacy_config_files(&[path], DumpConfigFormat::Toml).unwrap();
|
|
1997
|
-
assert!(converted.contains("
|
|
2025
|
+
assert!(converted.contains("separate_ctrl_name_with_space = true"));
|
|
2026
|
+
assert!(!converted.contains("space_before_definition_paren"));
|
|
1998
2027
|
}
|
|
1999
2028
|
|
|
2000
2029
|
#[test]
|
|
@@ -2004,7 +2033,7 @@ misc:
|
|
|
2004
2033
|
std::fs::write(&path, "format:\n separate_fn_name_with_space: false\n").unwrap();
|
|
2005
2034
|
|
|
2006
2035
|
let converted = convert_legacy_config_files(&[path], DumpConfigFormat::Toml).unwrap();
|
|
2007
|
-
assert!(converted.contains("
|
|
2036
|
+
assert!(converted.contains("separate_fn_name_with_space = false"));
|
|
2008
2037
|
}
|
|
2009
2038
|
|
|
2010
2039
|
#[test]
|