Fix Diagnostics #93
This commit is contained in:
@@ -1023,7 +1023,9 @@ impl LanguageServer for Backend {
|
|||||||
let text = if let Some(text) = ¶ms.text {
|
let text = if let Some(text) = ¶ms.text {
|
||||||
text.clone()
|
text.clone()
|
||||||
} else {
|
} else {
|
||||||
tokio::fs::read_to_string(&mist_path).await.expect("Failed to read file")
|
tokio::fs::read_to_string(&mist_path)
|
||||||
|
.await
|
||||||
|
.expect("Failed to read file")
|
||||||
};
|
};
|
||||||
|
|
||||||
self.documents
|
self.documents
|
||||||
@@ -1036,6 +1038,14 @@ impl LanguageServer for Backend {
|
|||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Self::write_transpiled_to_disk(&transpiled);
|
Self::write_transpiled_to_disk(&transpiled);
|
||||||
|
if let Some(rust_uri) = clean_lsp_url(&transpiled.rust_path) {
|
||||||
|
let _ = self
|
||||||
|
.rust_analyzer
|
||||||
|
.lock()
|
||||||
|
.await
|
||||||
|
.did_save(rust_uri, &transpiled.rust_content)
|
||||||
|
.await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.rebuild_module_tree(true).await;
|
self.rebuild_module_tree(true).await;
|
||||||
}
|
}
|
||||||
@@ -1817,9 +1827,6 @@ async fn handle_ra_notifications(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if let Some(mist_uri) = mist_uri.or(Some(rust_uri.clone())) {
|
if let Some(mist_uri) = mist_uri.or(Some(rust_uri.clone())) {
|
||||||
let prev = previous_diagnostics.lock().await.get(&mist_uri).cloned();
|
|
||||||
|
|
||||||
if prev.as_ref() != Some(&mapped_diagnostics) {
|
|
||||||
previous_diagnostics
|
previous_diagnostics
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
@@ -1830,7 +1837,6 @@ async fn handle_ra_notifications(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -374,6 +374,23 @@ impl RustAnalyzer {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn did_save(
|
||||||
|
&mut self,
|
||||||
|
uri: Url,
|
||||||
|
text: &str,
|
||||||
|
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
|
self.notify(
|
||||||
|
"textDocument/didSave",
|
||||||
|
json!({
|
||||||
|
"textDocument": {
|
||||||
|
"uri": uri,
|
||||||
|
},
|
||||||
|
"text": text,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn did_close(
|
pub async fn did_close(
|
||||||
&mut self,
|
&mut self,
|
||||||
uri: Url,
|
uri: Url,
|
||||||
|
|||||||
Reference in New Issue
Block a user