Fix warnings and propogate async further
This commit is contained in:
@@ -31,8 +31,8 @@ use language::{
|
||||
Transaction,
|
||||
};
|
||||
use lsp::{
|
||||
CompletionList, DiagnosticSeverity, DiagnosticTag, DocumentHighlightKind, LanguageServer,
|
||||
LanguageString, MarkedString,
|
||||
DiagnosticSeverity, DiagnosticTag, DocumentHighlightKind, LanguageServer, LanguageString,
|
||||
MarkedString,
|
||||
};
|
||||
use lsp_command::*;
|
||||
use parking_lot::Mutex;
|
||||
@@ -1732,7 +1732,7 @@ impl Project {
|
||||
.await?;
|
||||
this.update(&mut cx, |this, cx| {
|
||||
this.assign_language_to_buffer(&buffer, cx);
|
||||
this.register_buffer_with_language_server(&buffer, cx);
|
||||
this.register_buffer_with_language_server(&buffer, cx).await;
|
||||
});
|
||||
Ok(())
|
||||
})
|
||||
@@ -1786,12 +1786,12 @@ impl Project {
|
||||
))?,
|
||||
}
|
||||
cx.subscribe(buffer, |this, buffer, event, cx| {
|
||||
this.on_buffer_event(buffer, event, cx);
|
||||
this.on_buffer_event(buffer, event, cx).await;
|
||||
})
|
||||
.detach();
|
||||
|
||||
self.assign_language_to_buffer(buffer, cx);
|
||||
self.register_buffer_with_language_server(buffer, cx);
|
||||
self.register_buffer_with_language_server(buffer, cx).await;
|
||||
cx.observe_release(buffer, |this, buffer, cx| {
|
||||
if let Some(file) = File::from_dyn(buffer.file()) {
|
||||
if file.is_local() {
|
||||
@@ -2052,7 +2052,8 @@ impl Project {
|
||||
let worktree = file.worktree.read(cx).as_local()?;
|
||||
let worktree_id = worktree.id();
|
||||
let worktree_abs_path = worktree.abs_path().clone();
|
||||
self.start_language_server(worktree_id, worktree_abs_path, language, cx);
|
||||
self.start_language_server(worktree_id, worktree_abs_path, language, cx)
|
||||
.await;
|
||||
|
||||
None
|
||||
}
|
||||
@@ -2404,7 +2405,8 @@ impl Project {
|
||||
.collect();
|
||||
for (worktree_id, worktree_abs_path, full_path) in language_server_lookup_info {
|
||||
let language = self.languages.select_language(&full_path)?;
|
||||
self.restart_language_server(worktree_id, worktree_abs_path, language, cx);
|
||||
self.restart_language_server(worktree_id, worktree_abs_path, language, cx)
|
||||
.await;
|
||||
}
|
||||
|
||||
None
|
||||
@@ -2462,7 +2464,7 @@ impl Project {
|
||||
adapter: &Arc<dyn LspAdapter>,
|
||||
cx: &mut ModelContext<'_, Self>,
|
||||
) {
|
||||
adapter.process_diagnostics(&mut params);
|
||||
adapter.process_diagnostics(&mut params).await;
|
||||
self.update_diagnostics(
|
||||
server_id,
|
||||
params,
|
||||
@@ -4640,7 +4642,7 @@ impl Project {
|
||||
for (buffer, old_path) in renamed_buffers {
|
||||
self.unregister_buffer_from_language_server(&buffer, old_path, cx);
|
||||
self.assign_language_to_buffer(&buffer, cx);
|
||||
self.register_buffer_with_language_server(&buffer, cx);
|
||||
self.register_buffer_with_language_server(&buffer, cx).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
use gpui::{
|
||||
executor::{self, Background},
|
||||
Task,
|
||||
};
|
||||
use gpui::executor::Background;
|
||||
pub use language::*;
|
||||
use rust_embed::RustEmbed;
|
||||
use std::{borrow::Cow, str, sync::Arc};
|
||||
|
||||
@@ -2,15 +2,11 @@ use super::installation::{latest_github_release, GitHubLspBinaryVersion};
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use async_trait::async_trait;
|
||||
use client::http::HttpClient;
|
||||
use futures::{future::BoxFuture, FutureExt, StreamExt};
|
||||
use futures::StreamExt;
|
||||
pub use language::*;
|
||||
use smol::fs::{self, File};
|
||||
use std::{
|
||||
any::Any,
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
use util::{ResultExt, TryFutureExt};
|
||||
use std::{any::Any, path::PathBuf, sync::Arc};
|
||||
use util::ResultExt;
|
||||
|
||||
pub struct CLspAdapter;
|
||||
|
||||
|
||||
@@ -2,19 +2,13 @@ use super::installation::latest_github_release;
|
||||
use anyhow::{anyhow, Result};
|
||||
use async_trait::async_trait;
|
||||
use client::http::HttpClient;
|
||||
use futures::{future::BoxFuture, FutureExt, StreamExt};
|
||||
use futures::StreamExt;
|
||||
pub use language::*;
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
use smol::{fs, process};
|
||||
use std::{
|
||||
any::Any,
|
||||
ops::Range,
|
||||
path::{Path, PathBuf},
|
||||
str,
|
||||
sync::Arc,
|
||||
};
|
||||
use util::{ResultExt, TryFutureExt};
|
||||
use std::{any::Any, ops::Range, path::PathBuf, str, sync::Arc};
|
||||
use util::ResultExt;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct GoLspAdapter;
|
||||
|
||||
@@ -2,16 +2,12 @@ use super::installation::{npm_install_packages, npm_package_latest_version};
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use async_trait::async_trait;
|
||||
use client::http::HttpClient;
|
||||
use futures::{future::BoxFuture, FutureExt, StreamExt};
|
||||
use futures::StreamExt;
|
||||
use language::{LanguageServerName, LspAdapter};
|
||||
use serde_json::json;
|
||||
use smol::fs;
|
||||
use std::{
|
||||
any::Any,
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
use util::{ResultExt, TryFutureExt};
|
||||
use std::{any::Any, path::PathBuf, sync::Arc};
|
||||
use util::ResultExt;
|
||||
|
||||
pub struct JsonLspAdapter;
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@ use async_trait::async_trait;
|
||||
use client::http::HttpClient;
|
||||
use futures::lock::Mutex;
|
||||
use futures::Future;
|
||||
use futures::{future::BoxFuture, FutureExt};
|
||||
use gpui::executor::Background;
|
||||
use language::{LanguageServerName, LspAdapter};
|
||||
use plugin_runtime::{Plugin, PluginBuilder, WasiFn};
|
||||
use std::task::Poll;
|
||||
use std::{any::Any, path::PathBuf, sync::Arc};
|
||||
use util::ResultExt;
|
||||
|
||||
|
||||
@@ -2,15 +2,11 @@ use super::installation::{npm_install_packages, npm_package_latest_version};
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use async_trait::async_trait;
|
||||
use client::http::HttpClient;
|
||||
use futures::{future::BoxFuture, FutureExt, StreamExt};
|
||||
use futures::StreamExt;
|
||||
use language::{LanguageServerName, LspAdapter};
|
||||
use smol::fs;
|
||||
use std::{
|
||||
any::Any,
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
use util::{ResultExt, TryFutureExt};
|
||||
use std::{any::Any, path::PathBuf, sync::Arc};
|
||||
use util::ResultExt;
|
||||
|
||||
pub struct PythonLspAdapter;
|
||||
|
||||
|
||||
@@ -3,20 +3,13 @@ use anyhow::{anyhow, Result};
|
||||
use async_compression::futures::bufread::GzipDecoder;
|
||||
use async_trait::async_trait;
|
||||
use client::http::HttpClient;
|
||||
use futures::{future::BoxFuture, io::BufReader, FutureExt, StreamExt};
|
||||
use futures::{io::BufReader, StreamExt};
|
||||
pub use language::*;
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
use smol::fs::{self, File};
|
||||
use std::{
|
||||
any::Any,
|
||||
borrow::Cow,
|
||||
env::consts,
|
||||
path::{Path, PathBuf},
|
||||
str,
|
||||
sync::Arc,
|
||||
};
|
||||
use util::{ResultExt, TryFutureExt};
|
||||
use std::{any::Any, borrow::Cow, env::consts, path::PathBuf, str, sync::Arc};
|
||||
use util::ResultExt;
|
||||
|
||||
pub struct RustLspAdapter;
|
||||
|
||||
@@ -290,7 +283,7 @@ mod tests {
|
||||
},
|
||||
],
|
||||
};
|
||||
RustLspAdapter.process_diagnostics(&mut params);
|
||||
smol::block_on(RustLspAdapter.process_diagnostics(&mut params));
|
||||
|
||||
assert_eq!(params.diagnostics[0].message, "use of moved value `a`");
|
||||
|
||||
|
||||
@@ -2,16 +2,12 @@ use super::installation::{npm_install_packages, npm_package_latest_version};
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use async_trait::async_trait;
|
||||
use client::http::HttpClient;
|
||||
use futures::{future::BoxFuture, FutureExt, StreamExt};
|
||||
use futures::StreamExt;
|
||||
use language::{LanguageServerName, LspAdapter};
|
||||
use serde_json::json;
|
||||
use smol::fs;
|
||||
use std::{
|
||||
any::Any,
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
use util::{ResultExt, TryFutureExt};
|
||||
use std::{any::Any, path::PathBuf, sync::Arc};
|
||||
use util::ResultExt;
|
||||
|
||||
pub struct TypeScriptLspAdapter;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user