Reinstall Node whenever a NodeRuntime operation has serious error

This commit is contained in:
Julia 2023-06-28 16:43:45 -04:00
parent b2de28ccfc
commit db2b3e47bc
7 changed files with 126 additions and 87 deletions

View file

@ -263,11 +263,11 @@ impl LspAdapter for EsLintLspAdapter {
fs::rename(first.path(), &repo_root).await?;
self.node
.run_npm_subcommand(&repo_root, "install", &[])
.run_npm_subcommand(Some(&repo_root), "install", &[])
.await?;
self.node
.run_npm_subcommand(&repo_root, "run-script", &["compile"])
.run_npm_subcommand(Some(&repo_root), "run-script", &["compile"])
.await?;
}

View file

@ -131,7 +131,7 @@ fn main() {
languages.set_executor(cx.background().clone());
languages.set_language_server_download_dir(paths::LANGUAGES_DIR.clone());
let languages = Arc::new(languages);
let node_runtime = NodeRuntime::new(http.clone(), cx.background().to_owned());
let node_runtime = NodeRuntime::instance(http.clone(), cx.background().to_owned());
languages::init(languages.clone(), node_runtime.clone());
let user_store = cx.add_model(|cx| UserStore::new(client.clone(), http.clone(), cx));

View file

@ -2177,7 +2177,7 @@ mod tests {
languages.set_executor(cx.background().clone());
let languages = Arc::new(languages);
let http = FakeHttpClient::with_404_response();
let node_runtime = NodeRuntime::new(http, cx.background().to_owned());
let node_runtime = NodeRuntime::instance(http, cx.background().to_owned());
languages::init(languages.clone(), node_runtime);
for name in languages.language_names() {
languages.language_for_name(&name);