Skip to content

Commit

Permalink
fix(config): Don't overwrite locale and tokenizer config
Browse files Browse the repository at this point in the history
This was broken in #882
  • Loading branch information
epage committed Aug 22, 2024
1 parent 155346b commit 827b754
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
11 changes: 7 additions & 4 deletions crates/typos-cli/src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,16 @@ impl<'s> ConfigEngine<'s> {
let check_filename = engine.check_filename();
let check_file = engine.check_file();
let crate::config::EngineConfig {
tokenizer: mut tokenizer_config,
dict: mut dict_config,
tokenizer: tokenizer_user_config,
dict: dict_user_config,
extend_ignore_re,
..
} = engine;
tokenizer_config.update(&crate::config::TokenizerConfig::from_defaults());
dict_config.update(&crate::config::DictConfig::from_defaults());

let mut tokenizer_config = crate::config::TokenizerConfig::from_defaults();
tokenizer_config.update(&tokenizer_user_config);
let mut dict_config = crate::config::DictConfig::from_defaults();
dict_config.update(&dict_user_config);

if !tokenizer_config.ignore_hex() {
log::warn!("`ignore-hex` is deprecated");
Expand Down
10 changes: 9 additions & 1 deletion crates/typos-cli/tests/cmd/en-us.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
bin.name = "typos"
stdin = ""
stdout = ""
stdout = """
error: `colour` should be `color`
--> ./README.md:1:10
|
1 | color or colour
| ^^^^^^
|
"""
stderr = ""
status.code = 2

0 comments on commit 827b754

Please sign in to comment.