Omit tsdk_path from the servers' options if it does not exist (#23525)

Part of https://github.com/zed-industries/zed/issues/22606

Before, `tsdk_path` for vtsls and typescript-language-server
unconditionally set a `tsdk`/`tsserver` property for the corresponding
language server, even if there were no such directory at all.
Instead, make the corresponding code to omit such property if it was not
found on the FS.

Release Notes:

- Fixed "The path /.../tsserver.js doesn't point to a valid tsserver
install. Falling back to bundled TypeScript version." pop-up appearing
This commit is contained in:
Kirill Bulatov 2025-01-23 13:17:32 +02:00 committed by GitHub
parent d1be419fff
commit 91b0ca0895
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 92 additions and 19 deletions

1
Cargo.lock generated
View file

@ -6788,6 +6788,7 @@ dependencies = [
"async-trait", "async-trait",
"collections", "collections",
"extension", "extension",
"fs",
"futures 0.3.31", "futures 0.3.31",
"gpui", "gpui",
"language", "language",

View file

@ -25,6 +25,7 @@ use crate::language_settings::SoftWrap;
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use async_trait::async_trait; use async_trait::async_trait;
use collections::{HashMap, HashSet}; use collections::{HashMap, HashSet};
use fs::Fs;
use futures::Future; use futures::Future;
use gpui::{AppContext, AsyncAppContext, Model, SharedString, Task}; use gpui::{AppContext, AsyncAppContext, Model, SharedString, Task};
pub use highlight_map::HighlightMap; pub use highlight_map::HighlightMap;
@ -498,6 +499,7 @@ pub trait LspAdapter: 'static + Send + Sync {
/// Returns initialization options that are going to be sent to a LSP server as a part of [`lsp::InitializeParams`] /// Returns initialization options that are going to be sent to a LSP server as a part of [`lsp::InitializeParams`]
async fn initialization_options( async fn initialization_options(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
_: &Arc<dyn LspAdapterDelegate>, _: &Arc<dyn LspAdapterDelegate>,
) -> Result<Option<Value>> { ) -> Result<Option<Value>> {
Ok(None) Ok(None)
@ -505,6 +507,7 @@ pub trait LspAdapter: 'static + Send + Sync {
async fn workspace_configuration( async fn workspace_configuration(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
_: &Arc<dyn LspAdapterDelegate>, _: &Arc<dyn LspAdapterDelegate>,
_: Arc<dyn LanguageToolchainStore>, _: Arc<dyn LanguageToolchainStore>,
_cx: &mut AsyncAppContext, _cx: &mut AsyncAppContext,
@ -1901,6 +1904,7 @@ impl LspAdapter for FakeLspAdapter {
async fn initialization_options( async fn initialization_options(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
_: &Arc<dyn LspAdapterDelegate>, _: &Arc<dyn LspAdapterDelegate>,
) -> Result<Option<Value>> { ) -> Result<Option<Value>> {
Ok(self.initialization_options.clone()) Ok(self.initialization_options.clone())

View file

@ -17,6 +17,7 @@ async-trait.workspace = true
collections.workspace = true collections.workspace = true
extension.workspace = true extension.workspace = true
futures.workspace = true futures.workspace = true
fs.workspace = true
gpui.workspace = true gpui.workspace = true
language.workspace = true language.workspace = true
lsp.workspace = true lsp.workspace = true

View file

@ -8,6 +8,7 @@ use anyhow::{Context, Result};
use async_trait::async_trait; use async_trait::async_trait;
use collections::HashMap; use collections::HashMap;
use extension::{Extension, ExtensionLanguageServerProxy, WorktreeDelegate}; use extension::{Extension, ExtensionLanguageServerProxy, WorktreeDelegate};
use fs::Fs;
use futures::{Future, FutureExt}; use futures::{Future, FutureExt};
use gpui::AsyncAppContext; use gpui::AsyncAppContext;
use language::{ use language::{
@ -224,6 +225,7 @@ impl LspAdapter for ExtensionLspAdapter {
async fn initialization_options( async fn initialization_options(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
delegate: &Arc<dyn LspAdapterDelegate>, delegate: &Arc<dyn LspAdapterDelegate>,
) -> Result<Option<serde_json::Value>> { ) -> Result<Option<serde_json::Value>> {
let delegate = Arc::new(WorktreeDelegateAdapter(delegate.clone())) as _; let delegate = Arc::new(WorktreeDelegateAdapter(delegate.clone())) as _;
@ -246,6 +248,7 @@ impl LspAdapter for ExtensionLspAdapter {
async fn workspace_configuration( async fn workspace_configuration(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
delegate: &Arc<dyn LspAdapterDelegate>, delegate: &Arc<dyn LspAdapterDelegate>,
_: Arc<dyn LanguageToolchainStore>, _: Arc<dyn LanguageToolchainStore>,
_cx: &mut AsyncAppContext, _cx: &mut AsyncAppContext,

View file

@ -4,6 +4,7 @@ use futures::StreamExt;
use language::{LspAdapter, LspAdapterDelegate}; use language::{LspAdapter, LspAdapterDelegate};
use lsp::{LanguageServerBinary, LanguageServerName}; use lsp::{LanguageServerBinary, LanguageServerName};
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use project::Fs;
use serde_json::json; use serde_json::json;
use smol::fs; use smol::fs;
use std::{ use std::{
@ -107,6 +108,7 @@ impl LspAdapter for CssLspAdapter {
async fn initialization_options( async fn initialization_options(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
_: &Arc<dyn LspAdapterDelegate>, _: &Arc<dyn LspAdapterDelegate>,
) -> Result<Option<serde_json::Value>> { ) -> Result<Option<serde_json::Value>> {
Ok(Some(json!({ Ok(Some(json!({

View file

@ -6,6 +6,7 @@ use gpui::{AppContext, AsyncAppContext, Task};
use http_client::github::latest_github_release; use http_client::github::latest_github_release;
pub use language::*; pub use language::*;
use lsp::{LanguageServerBinary, LanguageServerName}; use lsp::{LanguageServerBinary, LanguageServerName};
use project::Fs;
use regex::Regex; use regex::Regex;
use serde_json::json; use serde_json::json;
use smol::fs; use smol::fs;
@ -197,6 +198,7 @@ impl super::LspAdapter for GoLspAdapter {
async fn initialization_options( async fn initialization_options(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
_: &Arc<dyn LspAdapterDelegate>, _: &Arc<dyn LspAdapterDelegate>,
) -> Result<Option<serde_json::Value>> { ) -> Result<Option<serde_json::Value>> {
Ok(Some(json!({ Ok(Some(json!({

View file

@ -9,7 +9,7 @@ use http_client::github::{latest_github_release, GitHubLspBinaryVersion};
use language::{LanguageRegistry, LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use language::{LanguageRegistry, LanguageToolchainStore, LspAdapter, LspAdapterDelegate};
use lsp::{LanguageServerBinary, LanguageServerName}; use lsp::{LanguageServerBinary, LanguageServerName};
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use project::{lsp_store::language_server_settings, ContextProviderWithTasks}; use project::{lsp_store::language_server_settings, ContextProviderWithTasks, Fs};
use serde_json::{json, Value}; use serde_json::{json, Value};
use settings::{KeymapFile, SettingsJsonSchemaParams, SettingsStore}; use settings::{KeymapFile, SettingsJsonSchemaParams, SettingsStore};
use smol::{ use smol::{
@ -208,6 +208,7 @@ impl LspAdapter for JsonLspAdapter {
async fn initialization_options( async fn initialization_options(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
_: &Arc<dyn LspAdapterDelegate>, _: &Arc<dyn LspAdapterDelegate>,
) -> Result<Option<serde_json::Value>> { ) -> Result<Option<serde_json::Value>> {
Ok(Some(json!({ Ok(Some(json!({
@ -217,6 +218,7 @@ impl LspAdapter for JsonLspAdapter {
async fn workspace_configuration( async fn workspace_configuration(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
delegate: &Arc<dyn LspAdapterDelegate>, delegate: &Arc<dyn LspAdapterDelegate>,
_: Arc<dyn LanguageToolchainStore>, _: Arc<dyn LanguageToolchainStore>,
cx: &mut AsyncAppContext, cx: &mut AsyncAppContext,

View file

@ -18,6 +18,7 @@ use pet_core::os_environment::Environment;
use pet_core::python_environment::PythonEnvironmentKind; use pet_core::python_environment::PythonEnvironmentKind;
use pet_core::Configuration; use pet_core::Configuration;
use project::lsp_store::language_server_settings; use project::lsp_store::language_server_settings;
use project::Fs;
use serde_json::{json, Value}; use serde_json::{json, Value};
use smol::lock::OnceCell; use smol::lock::OnceCell;
use std::cmp::Ordering; use std::cmp::Ordering;
@ -250,6 +251,7 @@ impl LspAdapter for PythonLspAdapter {
async fn workspace_configuration( async fn workspace_configuration(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
adapter: &Arc<dyn LspAdapterDelegate>, adapter: &Arc<dyn LspAdapterDelegate>,
toolchains: Arc<dyn LanguageToolchainStore>, toolchains: Arc<dyn LanguageToolchainStore>,
cx: &mut AsyncAppContext, cx: &mut AsyncAppContext,
@ -931,6 +933,7 @@ impl LspAdapter for PyLspAdapter {
async fn workspace_configuration( async fn workspace_configuration(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
adapter: &Arc<dyn LspAdapterDelegate>, adapter: &Arc<dyn LspAdapterDelegate>,
toolchains: Arc<dyn LanguageToolchainStore>, toolchains: Arc<dyn LanguageToolchainStore>,
cx: &mut AsyncAppContext, cx: &mut AsyncAppContext,

View file

@ -6,7 +6,7 @@ use gpui::AsyncAppContext;
use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate};
use lsp::{LanguageServerBinary, LanguageServerName}; use lsp::{LanguageServerBinary, LanguageServerName};
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use project::lsp_store::language_server_settings; use project::{lsp_store::language_server_settings, Fs};
use serde_json::{json, Value}; use serde_json::{json, Value};
use smol::fs; use smol::fs;
use std::{ use std::{
@ -116,6 +116,7 @@ impl LspAdapter for TailwindLspAdapter {
async fn initialization_options( async fn initialization_options(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
_: &Arc<dyn LspAdapterDelegate>, _: &Arc<dyn LspAdapterDelegate>,
) -> Result<Option<serde_json::Value>> { ) -> Result<Option<serde_json::Value>> {
Ok(Some(json!({ Ok(Some(json!({
@ -131,6 +132,7 @@ impl LspAdapter for TailwindLspAdapter {
async fn workspace_configuration( async fn workspace_configuration(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
delegate: &Arc<dyn LspAdapterDelegate>, delegate: &Arc<dyn LspAdapterDelegate>,
_: Arc<dyn LanguageToolchainStore>, _: Arc<dyn LanguageToolchainStore>,
cx: &mut AsyncAppContext, cx: &mut AsyncAppContext,

View file

@ -8,8 +8,8 @@ use http_client::github::{build_asset_url, AssetKind, GitHubLspBinaryVersion};
use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate};
use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerName}; use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerName};
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use project::lsp_store::language_server_settings;
use project::ContextProviderWithTasks; use project::ContextProviderWithTasks;
use project::{lsp_store::language_server_settings, Fs};
use serde_json::{json, Value}; use serde_json::{json, Value};
use smol::{fs, io::BufReader, stream::StreamExt}; use smol::{fs, io::BufReader, stream::StreamExt};
use std::{ use std::{
@ -77,16 +77,25 @@ impl TypeScriptLspAdapter {
pub fn new(node: NodeRuntime) -> Self { pub fn new(node: NodeRuntime) -> Self {
TypeScriptLspAdapter { node } TypeScriptLspAdapter { node }
} }
async fn tsdk_path(adapter: &Arc<dyn LspAdapterDelegate>) -> &'static str { async fn tsdk_path(fs: &dyn Fs, adapter: &Arc<dyn LspAdapterDelegate>) -> Option<&'static str> {
let is_yarn = adapter let is_yarn = adapter
.read_text_file(PathBuf::from(".yarn/sdks/typescript/lib/typescript.js")) .read_text_file(PathBuf::from(".yarn/sdks/typescript/lib/typescript.js"))
.await .await
.is_ok(); .is_ok();
if is_yarn { let tsdk_path = if is_yarn {
".yarn/sdks/typescript/lib" ".yarn/sdks/typescript/lib"
} else { } else {
"node_modules/typescript/lib" "node_modules/typescript/lib"
};
if fs
.is_dir(&adapter.worktree_root_path().join(tsdk_path))
.await
{
Some(tsdk_path)
} else {
None
} }
} }
} }
@ -233,9 +242,10 @@ impl LspAdapter for TypeScriptLspAdapter {
async fn initialization_options( async fn initialization_options(
self: Arc<Self>, self: Arc<Self>,
fs: &dyn Fs,
adapter: &Arc<dyn LspAdapterDelegate>, adapter: &Arc<dyn LspAdapterDelegate>,
) -> Result<Option<serde_json::Value>> { ) -> Result<Option<serde_json::Value>> {
let tsdk_path = Self::tsdk_path(adapter).await; let tsdk_path = Self::tsdk_path(fs, adapter).await;
Ok(Some(json!({ Ok(Some(json!({
"provideFormatter": true, "provideFormatter": true,
"hostInfo": "zed", "hostInfo": "zed",
@ -257,6 +267,7 @@ impl LspAdapter for TypeScriptLspAdapter {
async fn workspace_configuration( async fn workspace_configuration(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
delegate: &Arc<dyn LspAdapterDelegate>, delegate: &Arc<dyn LspAdapterDelegate>,
_: Arc<dyn LanguageToolchainStore>, _: Arc<dyn LanguageToolchainStore>,
cx: &mut AsyncAppContext, cx: &mut AsyncAppContext,
@ -353,6 +364,7 @@ impl LspAdapter for EsLintLspAdapter {
async fn workspace_configuration( async fn workspace_configuration(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
delegate: &Arc<dyn LspAdapterDelegate>, delegate: &Arc<dyn LspAdapterDelegate>,
_: Arc<dyn LanguageToolchainStore>, _: Arc<dyn LanguageToolchainStore>,
cx: &mut AsyncAppContext, cx: &mut AsyncAppContext,

View file

@ -5,7 +5,7 @@ use gpui::AsyncAppContext;
use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate};
use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerName}; use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerName};
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use project::lsp_store::language_server_settings; use project::{lsp_store::language_server_settings, Fs};
use serde_json::Value; use serde_json::Value;
use std::{ use std::{
any::Any, any::Any,
@ -34,16 +34,25 @@ impl VtslsLspAdapter {
VtslsLspAdapter { node } VtslsLspAdapter { node }
} }
async fn tsdk_path(adapter: &Arc<dyn LspAdapterDelegate>) -> &'static str { async fn tsdk_path(fs: &dyn Fs, adapter: &Arc<dyn LspAdapterDelegate>) -> Option<&'static str> {
let is_yarn = adapter let is_yarn = adapter
.read_text_file(PathBuf::from(".yarn/sdks/typescript/lib/typescript.js")) .read_text_file(PathBuf::from(".yarn/sdks/typescript/lib/typescript.js"))
.await .await
.is_ok(); .is_ok();
if is_yarn { let tsdk_path = if is_yarn {
".yarn/sdks/typescript/lib" ".yarn/sdks/typescript/lib"
} else { } else {
Self::TYPESCRIPT_TSDK_PATH Self::TYPESCRIPT_TSDK_PATH
};
if fs
.is_dir(&adapter.worktree_root_path().join(tsdk_path))
.await
{
Some(tsdk_path)
} else {
None
} }
} }
} }
@ -196,11 +205,12 @@ impl LspAdapter for VtslsLspAdapter {
async fn workspace_configuration( async fn workspace_configuration(
self: Arc<Self>, self: Arc<Self>,
fs: &dyn Fs,
delegate: &Arc<dyn LspAdapterDelegate>, delegate: &Arc<dyn LspAdapterDelegate>,
_: Arc<dyn LanguageToolchainStore>, _: Arc<dyn LanguageToolchainStore>,
cx: &mut AsyncAppContext, cx: &mut AsyncAppContext,
) -> Result<Value> { ) -> Result<Value> {
let tsdk_path = Self::tsdk_path(delegate).await; let tsdk_path = Self::tsdk_path(fs, delegate).await;
let config = serde_json::json!({ let config = serde_json::json!({
"tsdk": tsdk_path, "tsdk": tsdk_path,
"suggest": { "suggest": {

View file

@ -7,7 +7,7 @@ use language::{
}; };
use lsp::{LanguageServerBinary, LanguageServerName}; use lsp::{LanguageServerBinary, LanguageServerName};
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use project::lsp_store::language_server_settings; use project::{lsp_store::language_server_settings, Fs};
use serde_json::Value; use serde_json::Value;
use settings::{Settings, SettingsLocation}; use settings::{Settings, SettingsLocation};
use smol::fs; use smol::fs;
@ -128,6 +128,7 @@ impl LspAdapter for YamlLspAdapter {
async fn workspace_configuration( async fn workspace_configuration(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
delegate: &Arc<dyn LspAdapterDelegate>, delegate: &Arc<dyn LspAdapterDelegate>,
_: Arc<dyn LanguageToolchainStore>, _: Arc<dyn LanguageToolchainStore>,
cx: &mut AsyncAppContext, cx: &mut AsyncAppContext,

View file

@ -239,6 +239,7 @@ impl LocalLspStore {
let adapter = adapter.clone(); let adapter = adapter.clone();
let this = self.weak.clone(); let this = self.weak.clone();
let pending_workspace_folders = pending_workspace_folders.clone(); let pending_workspace_folders = pending_workspace_folders.clone();
let fs = self.fs.clone();
cx.spawn(move |mut cx| async move { cx.spawn(move |mut cx| async move {
let result = { let result = {
let delegate = delegate.clone(); let delegate = delegate.clone();
@ -254,13 +255,18 @@ impl LocalLspStore {
let workspace_config = adapter let workspace_config = adapter
.adapter .adapter
.clone() .clone()
.workspace_configuration(&delegate, toolchains.clone(), &mut cx) .workspace_configuration(
fs.as_ref(),
&delegate,
toolchains.clone(),
&mut cx,
)
.await?; .await?;
let mut initialization_options = adapter let mut initialization_options = adapter
.adapter .adapter
.clone() .clone()
.initialization_options(&(delegate)) .initialization_options(fs.as_ref(), &(delegate))
.await?; .await?;
match (&mut initialization_options, override_options) { match (&mut initialization_options, override_options) {
@ -277,7 +283,13 @@ impl LocalLspStore {
adapter.adapter.prepare_initialize_params(params) adapter.adapter.prepare_initialize_params(params)
})??; })??;
Self::setup_lsp_messages(this.clone(), &language_server, delegate, adapter); Self::setup_lsp_messages(
this.clone(),
fs,
&language_server,
delegate,
adapter,
);
let did_change_configuration_params = let did_change_configuration_params =
Arc::new(lsp::DidChangeConfigurationParams { Arc::new(lsp::DidChangeConfigurationParams {
@ -425,6 +437,7 @@ impl LocalLspStore {
fn setup_lsp_messages( fn setup_lsp_messages(
this: WeakModel<LspStore>, this: WeakModel<LspStore>,
fs: Arc<dyn Fs>,
language_server: &LanguageServer, language_server: &LanguageServer,
delegate: Arc<dyn LspAdapterDelegate>, delegate: Arc<dyn LspAdapterDelegate>,
adapter: Arc<CachedLspAdapter>, adapter: Arc<CachedLspAdapter>,
@ -458,15 +471,17 @@ impl LocalLspStore {
let adapter = adapter.adapter.clone(); let adapter = adapter.adapter.clone();
let delegate = delegate.clone(); let delegate = delegate.clone();
let this = this.clone(); let this = this.clone();
let fs = fs.clone();
move |params, mut cx| { move |params, mut cx| {
let adapter = adapter.clone(); let adapter = adapter.clone();
let delegate = delegate.clone(); let delegate = delegate.clone();
let this = this.clone(); let this = this.clone();
let fs = fs.clone();
async move { async move {
let toolchains = let toolchains =
this.update(&mut cx, |this, cx| this.toolchain_store(cx))?; this.update(&mut cx, |this, cx| this.toolchain_store(cx))?;
let workspace_config = adapter let workspace_config = adapter
.workspace_configuration(&delegate, toolchains, &mut cx) .workspace_configuration(fs.as_ref(), &delegate, toolchains, &mut cx)
.await?; .await?;
Ok(params Ok(params
.items .items
@ -3029,7 +3044,10 @@ impl LspStore {
let _maintain_workspace_config = { let _maintain_workspace_config = {
let (sender, receiver) = watch::channel(); let (sender, receiver) = watch::channel();
(Self::maintain_workspace_config(receiver, cx), sender) (
Self::maintain_workspace_config(fs.clone(), receiver, cx),
sender,
)
}; };
let project_tree = ProjectTree::new(worktree_store.clone(), cx); let project_tree = ProjectTree::new(worktree_store.clone(), cx);
Self { Self {
@ -3093,6 +3111,7 @@ impl LspStore {
}) })
} }
#[allow(clippy::too_many_arguments)]
pub(super) fn new_remote( pub(super) fn new_remote(
buffer_store: Model<BufferStore>, buffer_store: Model<BufferStore>,
worktree_store: Model<WorktreeStore>, worktree_store: Model<WorktreeStore>,
@ -3100,6 +3119,7 @@ impl LspStore {
languages: Arc<LanguageRegistry>, languages: Arc<LanguageRegistry>,
upstream_client: AnyProtoClient, upstream_client: AnyProtoClient,
project_id: u64, project_id: u64,
fs: Arc<dyn Fs>,
cx: &mut ModelContext<Self>, cx: &mut ModelContext<Self>,
) -> Self { ) -> Self {
cx.subscribe(&buffer_store, Self::on_buffer_store_event) cx.subscribe(&buffer_store, Self::on_buffer_store_event)
@ -3108,7 +3128,7 @@ impl LspStore {
.detach(); .detach();
let _maintain_workspace_config = { let _maintain_workspace_config = {
let (sender, receiver) = watch::channel(); let (sender, receiver) = watch::channel();
(Self::maintain_workspace_config(receiver, cx), sender) (Self::maintain_workspace_config(fs, receiver, cx), sender)
}; };
Self { Self {
mode: LspStoreMode::Remote(RemoteLspStore { mode: LspStoreMode::Remote(RemoteLspStore {
@ -5138,6 +5158,7 @@ impl LspStore {
pub(crate) async fn refresh_workspace_configurations( pub(crate) async fn refresh_workspace_configurations(
this: &WeakModel<Self>, this: &WeakModel<Self>,
fs: Arc<dyn Fs>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) { ) {
maybe!(async move { maybe!(async move {
@ -5190,7 +5211,12 @@ impl LspStore {
.ok()?; .ok()?;
for (adapter, server, delegate) in servers { for (adapter, server, delegate) in servers {
let settings = adapter let settings = adapter
.workspace_configuration(&delegate, toolchain_store.clone(), &mut cx) .workspace_configuration(
fs.as_ref(),
&delegate,
toolchain_store.clone(),
&mut cx,
)
.await .await
.ok()?; .ok()?;
@ -5213,6 +5239,7 @@ impl LspStore {
} }
} }
fn maintain_workspace_config( fn maintain_workspace_config(
fs: Arc<dyn Fs>,
external_refresh_requests: watch::Receiver<()>, external_refresh_requests: watch::Receiver<()>,
cx: &mut ModelContext<Self>, cx: &mut ModelContext<Self>,
) -> Task<Result<()>> { ) -> Task<Result<()>> {
@ -5227,7 +5254,7 @@ impl LspStore {
futures::stream::select(settings_changed_rx, external_refresh_requests); futures::stream::select(settings_changed_rx, external_refresh_requests);
cx.spawn(move |this, cx| async move { cx.spawn(move |this, cx| async move {
while let Some(()) = joint_future.next().await { while let Some(()) = joint_future.next().await {
Self::refresh_workspace_configurations(&this, cx.clone()).await; Self::refresh_workspace_configurations(&this, fs.clone(), cx.clone()).await;
} }
drop(settings_observation); drop(settings_observation);
@ -8454,6 +8481,7 @@ impl LspAdapter for SshLspAdapter {
async fn initialization_options( async fn initialization_options(
self: Arc<Self>, self: Arc<Self>,
_: &dyn Fs,
_: &Arc<dyn LspAdapterDelegate>, _: &Arc<dyn LspAdapterDelegate>,
) -> Result<Option<serde_json::Value>> { ) -> Result<Option<serde_json::Value>> {
let Some(options) = &self.initialization_options else { let Some(options) = &self.initialization_options else {

View file

@ -810,6 +810,7 @@ impl Project {
languages.clone(), languages.clone(),
ssh_proto.clone(), ssh_proto.clone(),
SSH_PROJECT_ID, SSH_PROJECT_ID,
fs.clone(),
cx, cx,
) )
}); });
@ -983,6 +984,7 @@ impl Project {
languages.clone(), languages.clone(),
client.clone().into(), client.clone().into(),
remote_id, remote_id,
fs.clone(),
cx, cx,
); );
lsp_store.set_language_server_statuses_from_proto(response.payload.language_servers); lsp_store.set_language_server_statuses_from_proto(response.payload.language_servers);