Skip to content

Commit

Permalink
feat(config): support parsing json w/ comments
Browse files Browse the repository at this point in the history
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
  • Loading branch information
LGUG2Z committed Mar 1, 2024
1 parent 4e98d7d commit d730c3c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 9 deletions.
19 changes: 15 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion komorebi-client/Cargo.toml
Expand Up @@ -9,4 +9,4 @@ edition = "2021"
komorebi = { path = "../komorebi" }
komorebi-core = { path = "../komorebi-core" }
uds_windows = "1"
serde_json = "1"
serde_json = { workspace = true }
2 changes: 1 addition & 1 deletion komorebi-core/Cargo.toml
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion komorebi/Cargo.toml
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion komorebi/src/window.rs
Expand Up @@ -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>,
Expand Down
2 changes: 1 addition & 1 deletion komorebic/Cargo.toml
Expand Up @@ -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"
Expand Down

0 comments on commit d730c3c

Please sign in to comment.