Skip to content

Commit

Permalink
fix: fallback biome won't install correctly (#45)
Browse files Browse the repository at this point in the history
* fix: fallback biome won't install correctly

* chore: remove unused method
  • Loading branch information
luckydye authored Sep 9, 2024
1 parent 7fc20c9 commit f6b708d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ edition = "2021"
license = "MIT"
name = "zed_biome"
publish = false
version = "0.1.1"
version = "0.1.2"

[lib]
crate-type = ["cdylib"]
Expand Down
2 changes: 1 addition & 1 deletion extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ id = "biome"
name = "Biome"
repository = "https://github.com/biomejs/biome-zed"
schema_version = 1
version = "0.1.1"
version = "0.1.2"

[language_servers.biome]
code_actions_kind = ["", "quickfix"]
Expand Down
17 changes: 4 additions & 13 deletions src/biome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ impl BiomeExtension {
))
}

fn resolve_binary(&self, root_path: &str) -> Result<PathBuf> {
let specifier = self.binary_specifier()?;
let local_binary_path = Path::new(root_path).join("node_modules").join(specifier);

if local_binary_path.exists() {
Ok(local_binary_path)
} else {
Err("Error: biome binary not found".to_string())
}
}

fn server_script_path(
&mut self,
language_server_id: &LanguageServerId,
Expand Down Expand Up @@ -83,7 +72,7 @@ impl BiomeExtension {
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
);

let fallback_server_path = &self.resolve_binary("./")?;
let fallback_server_path = &Path::new("./node_modules").join(self.binary_specifier()?);
let version = zed::npm_package_latest_version(PACKAGE_NAME)?;

if !self.server_exists(fallback_server_path)
Expand All @@ -104,7 +93,9 @@ impl BiomeExtension {
}
Err(error) => {
if !self.server_exists(fallback_server_path) {
Err(error)?;
Err(format!(
"failed to install package '{PACKAGE_NAME}': {error}"
))?;
}
}
}
Expand Down

0 comments on commit f6b708d

Please sign in to comment.