terraform: Don't cache user-installed terraform-ls
(#10641)
This PR updates the Terraform extension to not cache the binary when it is using the one on the $PATH. Release Notes: - N/A
This commit is contained in:
parent
5d7148bde1
commit
fa0302f156
1 changed files with 4 additions and 5 deletions
|
@ -12,17 +12,16 @@ impl TerraformExtension {
|
||||||
language_server_id: &LanguageServerId,
|
language_server_id: &LanguageServerId,
|
||||||
worktree: &zed::Worktree,
|
worktree: &zed::Worktree,
|
||||||
) -> Result<String> {
|
) -> Result<String> {
|
||||||
|
if let Some(path) = worktree.which("terraform-ls") {
|
||||||
|
return Ok(path);
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(path) = &self.cached_binary_path {
|
if let Some(path) = &self.cached_binary_path {
|
||||||
if fs::metadata(path).map_or(false, |stat| stat.is_file()) {
|
if fs::metadata(path).map_or(false, |stat| stat.is_file()) {
|
||||||
return Ok(path.clone());
|
return Ok(path.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(path) = worktree.which("terraform-ls") {
|
|
||||||
self.cached_binary_path = Some(path.clone());
|
|
||||||
return Ok(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
zed::set_language_server_installation_status(
|
zed::set_language_server_installation_status(
|
||||||
&language_server_id,
|
&language_server_id,
|
||||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue