mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-29 05:33:49 +00:00
vue: use anyhow::ensure instead of asserting on filesystem state (#3173)
Release Notes: - Fixed a crash on failed assertion in Vue.js language support.
This commit is contained in:
parent
e6f2288a0c
commit
1ec6638c7f
1 changed files with 9 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, ensure, Result};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
pub use language::*;
|
pub use language::*;
|
||||||
|
@ -98,7 +98,10 @@ impl super::LspAdapter for VueLspAdapter {
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
assert!(fs::metadata(&server_path).await.is_ok());
|
ensure!(
|
||||||
|
fs::metadata(&server_path).await.is_ok(),
|
||||||
|
"@vue/language-server package installation failed"
|
||||||
|
);
|
||||||
if fs::metadata(&ts_path).await.is_err() {
|
if fs::metadata(&ts_path).await.is_err() {
|
||||||
self.node
|
self.node
|
||||||
.npm_install_packages(
|
.npm_install_packages(
|
||||||
|
@ -108,7 +111,10 @@ impl super::LspAdapter for VueLspAdapter {
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert!(fs::metadata(&ts_path).await.is_ok());
|
ensure!(
|
||||||
|
fs::metadata(&ts_path).await.is_ok(),
|
||||||
|
"typescript for Vue package installation failed"
|
||||||
|
);
|
||||||
*self.typescript_install_path.lock() = Some(ts_path);
|
*self.typescript_install_path.lock() = Some(ts_path);
|
||||||
Ok(LanguageServerBinary {
|
Ok(LanguageServerBinary {
|
||||||
path: self.node.binary_path().await?,
|
path: self.node.binary_path().await?,
|
||||||
|
|
Loading…
Reference in a new issue