Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(spec compliance): settings are now consistent with other language servers
Elijah Potter8639c9bd2e99
diff --git a/harper-ls/README.md b/harper-ls/README.mdindex 972c19350..8040684ea 100644--- a/harper-ls/README.md+++ b/harper-ls/README.md@@ -45,7 +45,9 @@ If you use Neovim, you can set the location of the dictionary with the `userDict```lualspconfig.harper_ls.setup {settings = {- userDictPath = "~/dict.txt"+ ["harper-ls"] = {+ userDictPath = "~/dict.txt"+ }},}```diff --git a/harper-ls/src/config.rs b/harper-ls/src/config.rsindex 4d4421b5a..bcf36b5cf 100644--- a/harper-ls/src/config.rs+++ b/harper-ls/src/config.rs@@ -7,7 +7,7 @@ use serde_json::Value;#[derive(Debug, Clone)]pub struct Config {pub user_dict_path: PathBuf,- pub file_dict_path: PathBuf+ pub file_dict_path: PathBuf,}impl Config {@@ -18,6 +18,12 @@ impl Config {return Err(anyhow::format_err!("Settings must be an object."));};+ let Some(Value::Object(value)) = value.get("harper-ls") else {+ return Err(anyhow::format_err!(+ "Settings must contain a \"harper-ls\" key."+ ));+ };+if let Some(v) = value.get("userDictPath") {if let Value::String(path) = v {base.user_dict_path = path.try_resolve()?.to_path_buf();@@ -36,7 +42,7 @@ impl Default for Config {user_dict_path: config_dir().unwrap().join("harper-ls/dictionary.txt"),file_dict_path: data_local_dir().unwrap()- .join("harper-ls/file_dictionaries/")+ .join("harper-ls/file_dictionaries/"),}}}