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

View file

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

View file

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