Remove NodeRuntime static & add fake implementation for tests
This commit is contained in:
parent
9272e9354a
commit
8d672f5d4c
17 changed files with 179 additions and 131 deletions
|
@ -26,11 +26,11 @@ fn server_binary_arguments(server_path: &Path) -> Vec<OsString> {
|
|||
}
|
||||
|
||||
pub struct TailwindLspAdapter {
|
||||
node: Arc<NodeRuntime>,
|
||||
node: Arc<dyn NodeRuntime>,
|
||||
}
|
||||
|
||||
impl TailwindLspAdapter {
|
||||
pub fn new(node: Arc<NodeRuntime>) -> Self {
|
||||
pub fn new(node: Arc<dyn NodeRuntime>) -> Self {
|
||||
TailwindLspAdapter { node }
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ impl LspAdapter for TailwindLspAdapter {
|
|||
self.node
|
||||
.npm_install_packages(
|
||||
&container_dir,
|
||||
[("@tailwindcss/language-server", version.as_str())],
|
||||
&[("@tailwindcss/language-server", version.as_str())],
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
@ -85,14 +85,14 @@ impl LspAdapter for TailwindLspAdapter {
|
|||
container_dir: PathBuf,
|
||||
_: &dyn LspAdapterDelegate,
|
||||
) -> Option<LanguageServerBinary> {
|
||||
get_cached_server_binary(container_dir, &self.node).await
|
||||
get_cached_server_binary(container_dir, &*self.node).await
|
||||
}
|
||||
|
||||
async fn installation_test_binary(
|
||||
&self,
|
||||
container_dir: PathBuf,
|
||||
) -> Option<LanguageServerBinary> {
|
||||
get_cached_server_binary(container_dir, &self.node).await
|
||||
get_cached_server_binary(container_dir, &*self.node).await
|
||||
}
|
||||
|
||||
async fn initialization_options(&self) -> Option<serde_json::Value> {
|
||||
|
@ -131,7 +131,7 @@ impl LspAdapter for TailwindLspAdapter {
|
|||
|
||||
async fn get_cached_server_binary(
|
||||
container_dir: PathBuf,
|
||||
node: &NodeRuntime,
|
||||
node: &dyn NodeRuntime,
|
||||
) -> Option<LanguageServerBinary> {
|
||||
(|| async move {
|
||||
let mut last_version_dir = None;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue