feat(config): support parsing json w/ comments

This commit switches out the serde_json crate with the
serde_json_lenient crate, forked by Google, which allows for JSON files
with comments to be parsed properly.

Users can set the format of komorebi.json to "jsonc" in their editors in
order to write // comments without being faced with lint errors.

The expected file extension remains the same (json). komorebi and
komorebic will not look for files with the "jsonc" file extension or any
other JSON-variant file extension.

resolve #693
This commit is contained in:
LGUG2Z committed 2024-02-29 17:35:47 -08:00
1 parent 4e98d7d36d
commit d730c3c72d
7 files changed
+21 -9

No files matched your search

Generated
+15 -4
View File
@@ -779,7 +779,7 @@ dependencies = [
"regex",
"schemars",
"serde",
"serde_json",
"serde_json_lenient",
"strum",
"sysinfo",
"tracing",
@@ -801,7 +801,7 @@ version = "0.1.22-dev.0"
dependencies = [
"komorebi",
"komorebi-core",
"serde_json",
"serde_json_lenient",
"uds_windows",
]
@@ -815,7 +815,7 @@ dependencies = [
"dunce",
"schemars",
"serde",
"serde_json",
"serde_json_lenient",
"serde_yaml",
"strum",
"windows 0.54.0",
@@ -839,7 +839,7 @@ dependencies = [
"powershell_script",
"reqwest",
"serde",
"serde_json",
"serde_json_lenient",
"serde_yaml",
"sysinfo",
"thiserror",
@@ -1650,6 +1650,17 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_json_lenient"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc61c66b53a4035fcce237ef38043f4b2f0ebf918fd0e69541a5166104065581"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
+1
View File
@@ -16,6 +16,7 @@ windows-implement = { version = "0.53" }
dunce = "1"
dirs = "5"
color-eyre = "0.6"
serde_json = { package = "serde_json_lenient", version = "0.1" }
[workspace.dependencies.windows]
version = "0.54"
+1 -1
View File
@@ -9,4 +9,4 @@ edition = "2021"
komorebi = { path = "../komorebi" }
komorebi-core = { path = "../komorebi-core" }
uds_windows = "1"
serde_json = "1"
serde_json = { workspace = true }
+1 -1
View File
@@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
clap = { version = "4", features = ["derive"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_json = { workspace = true }
serde_yaml = "0.9"
strum = { version = "0.26", features = ["derive"] }
schemars = "0.8"
+1 -1
View File
@@ -33,7 +33,7 @@ paste = "1"
regex = "1"
schemars = "0.8"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_json = { workspace = true }
strum = { version = "0.26", features = ["derive"] }
sysinfo = "0.30"
tracing = "0.1"
+1 -1
View File
@@ -463,7 +463,7 @@ fn window_is_eligible(
title: &String,
exe_name: &String,
class: &String,
path: &String,
path: &str,
style: &WindowStyle,
ex_style: &ExtendedWindowStyle,
event: Option<WindowManagerEvent>,
+1 -1
View File
@@ -26,7 +26,7 @@ paste = "1"
powershell_script = "1.0"
reqwest = { version = "0.11", features = ["blocking"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_json = { workspace = true }
serde_yaml = "0.9"
sysinfo = "0.30"
thiserror = "1"