Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

feat(vscode-plugin): add `harper-ls.fileDictPath` setting

Matthew Espinof1364807c485
diff --git a/harper-ls/src/config.rs b/harper-ls/src/config.rs
index 34fc65a7c..cc56963b5 100644
--- a/harper-ls/src/config.rs
+++ b/harper-ls/src/config.rs
@@ -96,11 +96,14 @@ impl Config {
}
if let Some(v) = value.get("fileDictPath") {
- if let Value::String(path) = v {
- base.file_dict_path = path.try_resolve()?.to_path_buf();
- } else {
+ if !v.is_string() {
bail!("fileDict path must be a string.");
}
+
+ let path = v.as_str().unwrap();
+ if !path.is_empty() {
+ base.file_dict_path = path.try_resolve()?.to_path_buf();
+ }
}
if let Some(v) = value.get("linters") {
diff --git a/packages/vscode-plugin/package.json b/packages/vscode-plugin/package.json
index dae7e99c6..d0857cb7d 100644
--- a/packages/vscode-plugin/package.json
+++ b/packages/vscode-plugin/package.json
@@ -93,6 +93,11 @@
"default": "information",
"description": "How severe do you want diagnostics to appear in the editor?"
},
+ "harper-ls.fileDictPath": {
+ "scope": "resource",
+ "type": "string",
+ "description": "Optional path to a file dictionary directory to use."
+ },
"harper-ls.isolateEnglish": {
"scope": "resource",
"type": "boolean",