mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-09-27 04:19:22 +00:00
fix: properly await async operations in document handling
This commit is contained in:
parent
cd0b63f07b
commit
4b471a3c03
2 changed files with 4 additions and 3 deletions
|
@ -41,15 +41,16 @@ impl Store {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn publish_diagnostics(&self, uri: &str, client: &Client) {
|
pub async fn publish_diagnostics(&self, uri: &str, client: &Client) -> Result<()> {
|
||||||
if let Some(document) = self.get_document(uri) {
|
if let Some(document) = self.get_document(uri) {
|
||||||
let diagnostics = Diagnostics::generate_for_document(document);
|
let diagnostics = Diagnostics::generate_for_document(document);
|
||||||
client.publish_diagnostics(
|
client.publish_diagnostics(
|
||||||
Url::parse(uri).unwrap(),
|
Url::parse(uri).unwrap(),
|
||||||
diagnostics,
|
diagnostics,
|
||||||
Some(document.version),
|
Some(document.version),
|
||||||
);
|
).await;
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_did_change(
|
pub fn handle_did_change(
|
||||||
|
|
|
@ -110,7 +110,7 @@ impl LanguageServer for DjangoLanguageServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn did_open(&self, params: DidOpenTextDocumentParams) {
|
async fn did_open(&self, params: DidOpenTextDocumentParams) {
|
||||||
if let Err(e) = self.documents.write().await.handle_did_open(params.clone(), &self.client) {
|
if let Err(e) = self.documents.write().await.handle_did_open(params.clone(), &self.client).await {
|
||||||
eprintln!("Error handling document open: {}", e);
|
eprintln!("Error handling document open: {}", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue