Skip to content

Commit

Permalink
fix(ls): improve error handling for #251
Browse files Browse the repository at this point in the history
  • Loading branch information
elijah-potter committed Jan 3, 2025
1 parent 21fbf09 commit f70f289
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions harper-ls/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl Backend {
fn file_dict_name(url: &Url) -> Option<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() {
if !matches!(seg, Component::RootDir) {
rewritten.push_str(&seg.as_os_str().to_string_lossy());
Expand Down Expand Up @@ -120,7 +120,7 @@ impl Backend {
);

let Some(file_dictionary) = file_dictionary else {
return Err(anyhow!("Unable to compute dictionary path."));
return Err(anyhow!("Unable to compute dictionary path for {url}."));
};

let mut global_dictionary = global_dictionary?;
Expand Down Expand Up @@ -399,9 +399,13 @@ impl LanguageServer for Backend {
return;
};

self.update_document(&params.text_document.uri, &last.text, None)
if let Err(err) = self
.update_document(&params.text_document.uri, &last.text, None)
.await
.unwrap();
{
error!("{err}")
}

self.publish_diagnostics(&params.text_document.uri).await;
}

Expand Down

0 comments on commit f70f289

Please sign in to comment.