Pass an AsyncAppContext to fake language server request handlers
This commit is contained in:
@@ -13,7 +13,7 @@ use futures::{
|
||||
future::{BoxFuture, Shared},
|
||||
FutureExt, TryFutureExt,
|
||||
};
|
||||
use gpui::{AppContext, Task};
|
||||
use gpui::{MutableAppContext, Task};
|
||||
use highlight_map::HighlightMap;
|
||||
use lazy_static::lazy_static;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
@@ -225,7 +225,7 @@ impl LanguageRegistry {
|
||||
language: &Arc<Language>,
|
||||
root_path: Arc<Path>,
|
||||
http_client: Arc<dyn HttpClient>,
|
||||
cx: &AppContext,
|
||||
cx: &mut MutableAppContext,
|
||||
) -> Option<Task<Result<Arc<lsp::LanguageServer>>>> {
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
if let Some(config) = &language.config.language_server {
|
||||
@@ -234,7 +234,7 @@ impl LanguageRegistry {
|
||||
|
||||
let (server, mut fake_server) = lsp::LanguageServer::fake_with_capabilities(
|
||||
fake_config.capabilities.clone(),
|
||||
cx.background().clone(),
|
||||
cx,
|
||||
);
|
||||
|
||||
if let Some(initalizer) = &fake_config.initializer {
|
||||
|
||||
@@ -554,7 +554,7 @@ fn test_autoindent_adjusts_lines_when_only_text_changes(cx: &mut MutableAppConte
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_diagnostics(mut cx: gpui::TestAppContext) {
|
||||
let (language_server, mut fake) = lsp::LanguageServer::fake(cx.background());
|
||||
let (language_server, mut fake) = cx.update(lsp::LanguageServer::fake);
|
||||
let mut rust_lang = rust_lang();
|
||||
rust_lang.config.language_server = Some(LanguageServerConfig {
|
||||
disk_based_diagnostic_sources: HashSet::from_iter(["disk".to_string()]),
|
||||
@@ -837,7 +837,7 @@ async fn test_diagnostics(mut cx: gpui::TestAppContext) {
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_edits_from_lsp_with_past_version(mut cx: gpui::TestAppContext) {
|
||||
let (language_server, mut fake) = lsp::LanguageServer::fake(cx.background());
|
||||
let (language_server, mut fake) = cx.update(lsp::LanguageServer::fake);
|
||||
|
||||
let text = "
|
||||
fn a() {
|
||||
|
||||
Reference in New Issue
Block a user