Skip to content

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

Merge branch 'master' into ls-error-improvements

Grant Lemonsc76928551802
diff --cc harper-ls/src/backend.rs
index 444bd8273,85e2d9f78..8b09fd9c8
--- a/harper-ls/src/backend.rs
+++ b/harper-ls/src/backend.rs
@@@ -50,15 -51,11 +50,15 @@@ impl Backend
/// Rewrites a path to a filename using the same conventions as
/// [Neovim's undo-files](https://neovim.io/doc/user/options.html#'undodir').
- fn file_dict_name(url: &Url) -> Option<PathBuf> {
+ fn file_dict_name(url: &Url) -> anyhow::Result<PathBuf> {
let mut rewritten = String::new();
- // We assume all URLs are local files and have a base
+ // We assume all URLs are local files and have a base.
- for seg in url.to_file_path().ok()?.components() {
+ for seg in url
+ .to_file_path()
+ .map_err(|_| anyhow!("Unable to convert URL to file path."))?
+ .components()
+ {
if !matches!(seg, Component::RootDir) {
rewritten.push_str(&seg.as_os_str().to_string_lossy());
rewritten.push('%');