From 9cb14c189b476f87cf1698d1b0eb085696de9ef0 Mon Sep 17 00:00:00 2001 From: Julia Date: Thu, 9 Nov 2023 11:43:40 -0500 Subject: [PATCH] zed2: Get tsserver running again --- crates/zed2/src/languages/typescript.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/crates/zed2/src/languages/typescript.rs b/crates/zed2/src/languages/typescript.rs index de0139b3b2..1b96e7e702 100644 --- a/crates/zed2/src/languages/typescript.rs +++ b/crates/zed2/src/languages/typescript.rs @@ -2,6 +2,7 @@ use anyhow::{anyhow, Result}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use async_trait::async_trait; +use collections::HashMap; use futures::{future::BoxFuture, FutureExt}; use gpui::AppContext; use language::{LanguageServerName, LspAdapter, LspAdapterDelegate}; @@ -20,12 +21,7 @@ use util::{fs::remove_matching, github::latest_github_release}; use util::{github::GitHubLspBinaryVersion, ResultExt}; fn typescript_server_binary_arguments(server_path: &Path) -> Vec { - vec![ - server_path.into(), - "--stdio".into(), - "--tsserver-path".into(), - "node_modules/typescript/lib".into(), - ] + vec![server_path.into(), "--stdio".into()] } fn eslint_server_binary_arguments(server_path: &Path) -> Vec { @@ -158,9 +154,20 @@ impl LspAdapter for TypeScriptLspAdapter { async fn initialization_options(&self) -> Option { Some(json!({ - "provideFormatter": true + "provideFormatter": true, + "tsserver": { + "path": "node_modules/typescript/lib", + }, })) } + + async fn language_ids(&self) -> HashMap { + HashMap::from_iter([ + ("TypeScript".into(), "typescript".into()), + ("JavaScript".into(), "javascript".into()), + ("TSX".into(), "typescriptreact".into()), + ]) + } } async fn get_cached_ts_server_binary(