mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 14:17:02 +00:00
Get tsserver running again (#3277)
Release Notes: - Fixed a few issues preventing Javascript/Typescript language server from working with latest upstream changes.
This commit is contained in:
commit
27b3378020
1 changed files with 14 additions and 7 deletions
|
@ -2,6 +2,7 @@ use anyhow::{anyhow, Result};
|
||||||
use async_compression::futures::bufread::GzipDecoder;
|
use async_compression::futures::bufread::GzipDecoder;
|
||||||
use async_tar::Archive;
|
use async_tar::Archive;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
use collections::HashMap;
|
||||||
use futures::{future::BoxFuture, FutureExt};
|
use futures::{future::BoxFuture, FutureExt};
|
||||||
use gpui::AppContext;
|
use gpui::AppContext;
|
||||||
use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};
|
use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};
|
||||||
|
@ -20,12 +21,7 @@ use util::{fs::remove_matching, github::latest_github_release};
|
||||||
use util::{github::GitHubLspBinaryVersion, ResultExt};
|
use util::{github::GitHubLspBinaryVersion, ResultExt};
|
||||||
|
|
||||||
fn typescript_server_binary_arguments(server_path: &Path) -> Vec<OsString> {
|
fn typescript_server_binary_arguments(server_path: &Path) -> Vec<OsString> {
|
||||||
vec![
|
vec![server_path.into(), "--stdio".into()]
|
||||||
server_path.into(),
|
|
||||||
"--stdio".into(),
|
|
||||||
"--tsserver-path".into(),
|
|
||||||
"node_modules/typescript/lib".into(),
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn eslint_server_binary_arguments(server_path: &Path) -> Vec<OsString> {
|
fn eslint_server_binary_arguments(server_path: &Path) -> Vec<OsString> {
|
||||||
|
@ -158,9 +154,20 @@ impl LspAdapter for TypeScriptLspAdapter {
|
||||||
|
|
||||||
async fn initialization_options(&self) -> Option<serde_json::Value> {
|
async fn initialization_options(&self) -> Option<serde_json::Value> {
|
||||||
Some(json!({
|
Some(json!({
|
||||||
"provideFormatter": true
|
"provideFormatter": true,
|
||||||
|
"tsserver": {
|
||||||
|
"path": "node_modules/typescript/lib",
|
||||||
|
},
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn language_ids(&self) -> HashMap<String, String> {
|
||||||
|
HashMap::from_iter([
|
||||||
|
("TypeScript".into(), "typescript".into()),
|
||||||
|
("JavaScript".into(), "javascript".into()),
|
||||||
|
("TSX".into(), "typescriptreact".into()),
|
||||||
|
])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_cached_ts_server_binary(
|
async fn get_cached_ts_server_binary(
|
||||||
|
|
Loading…
Reference in a new issue