Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
terraform: Extract to zed-extensions/terraform repository (#26475)
Marshall Bowersefdb769f9b06
diff --git a/Cargo.lock b/Cargo.lockindex 311c386af47..d8d63e77bfd 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -17212,13 +17212,6 @@ dependencies = ["zed_extension_api 0.1.0",]-[[package]]-name = "zed_terraform"-version = "0.1.2"-dependencies = [- "zed_extension_api 0.1.0",-]-[[package]]name = "zed_test_extension"version = "0.1.0"diff --git a/Cargo.toml b/Cargo.tomlindex 61489190200..fde4d68d591 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -178,7 +178,6 @@ members = ["extensions/ruff","extensions/slash-commands-example","extensions/snippets",- "extensions/terraform","extensions/test-extension","extensions/toml","extensions/uiua",diff --git a/docs/src/languages/terraform.md b/docs/src/languages/terraform.mdindex bbafa9f203e..401526f1695 100644--- a/docs/src/languages/terraform.md+++ b/docs/src/languages/terraform.md@@ -1,6 +1,6 @@# Terraform-Terraform support is available through the [Terraform extension](https://github.com/zed-industries/zed/tree/main/extensions/terraform).+Terraform support is available through the [Terraform extension](https://github.com/zed-extensions/terraform).- Tree-sitter: [MichaHoffmann/tree-sitter-hcl](https://github.com/MichaHoffmann/tree-sitter-hcl)- Language Server: [hashicorp/terraform-ls](https://github.com/hashicorp/terraform-ls)diff --git a/extensions/terraform/Cargo.toml b/extensions/terraform/Cargo.tomldeleted file mode 100644index ecf1b86fa98..00000000000--- a/extensions/terraform/Cargo.toml+++ /dev/null@@ -1,16 +0,0 @@-[package]-name = "zed_terraform"-version = "0.1.2"-edition.workspace = true-publish.workspace = true-license = "Apache-2.0"--[lints]-workspace = true--[lib]-path = "src/terraform.rs"-crate-type = ["cdylib"]--[dependencies]-zed_extension_api = "0.1.0"diff --git a/extensions/terraform/LICENSE-APACHE b/extensions/terraform/LICENSE-APACHEdeleted file mode 120000index 1cd601d0a3a..00000000000--- a/extensions/terraform/LICENSE-APACHE+++ /dev/null@@ -1 +0,0 @@-../../LICENSE-APACHE\ No newline at end of filediff --git a/extensions/terraform/extension.toml b/extensions/terraform/extension.tomldeleted file mode 100644index 38e412715a2..00000000000--- a/extensions/terraform/extension.toml+++ /dev/null@@ -1,19 +0,0 @@-id = "terraform"-name = "Terraform"-description = "Terraform support."-version = "0.1.2"-schema_version = 1-authors = ["Caius Durling <[email protected]>", "Daniel Banck <[email protected]>"]-repository = "https://github.com/zed-industries/zed"--[language_servers.terraform-ls]-name = "Terraform Language Server"-languages = ["Terraform", "Terraform Vars"]-language_ids = { Terraform = "terraform", "Terraform Vars" = "terraform-vars" }-# TODO: file issue for server supported code actions-# TODO: reenable default actions / delete override-code_action_kinds = []--[grammars.hcl]-repository = "https://github.com/MichaHoffmann/tree-sitter-hcl"-commit = "e936d3fef8bac884661472dce71ad82284761eb1"diff --git a/extensions/terraform/languages/hcl/brackets.scm b/extensions/terraform/languages/hcl/brackets.scmdeleted file mode 100644index eff2faad54c..00000000000--- a/extensions/terraform/languages/hcl/brackets.scm+++ /dev/null@@ -1,5 +0,0 @@-("(" @open ")" @close)-("[" @open "]" @close)-("{" @open "}" @close)-((block_start) @open (block_end) @close)-((tuple_start) @open (tuple_end) @close)diff --git a/extensions/terraform/languages/hcl/config.toml b/extensions/terraform/languages/hcl/config.tomldeleted file mode 100644index be7e601e014..00000000000--- a/extensions/terraform/languages/hcl/config.toml+++ /dev/null@@ -1,15 +0,0 @@-name = "HCL"-grammar = "hcl"-path_suffixes = ["hcl"]-line_comments = ["# ", "// "]-block_comment = ["/*", "*/"]-autoclose_before = ",}])"-brackets = [- { start = "{", end = "}", close = true, newline = true },- { start = "[", end = "]", close = true, newline = true },- { start = "(", end = ")", close = true, newline = true },- { start = "\"", end = "\"", close = true, newline = false, not_in = ["comment", "string"] },- { start = "'", end = "'", close = true, newline = false, not_in = ["comment", "string"] },- { start = "/*", end = " */", close = true, newline = false, not_in = ["comment", "string"] },-]-tab_size = 2diff --git a/extensions/terraform/languages/hcl/highlights.scm b/extensions/terraform/languages/hcl/highlights.scmdeleted file mode 100644index a1713b3e3f5..00000000000--- a/extensions/terraform/languages/hcl/highlights.scm+++ /dev/null@@ -1,117 +0,0 @@-; https://github.com/nvim-treesitter/nvim-treesitter/blob/cb79d2446196d25607eb1d982c96939abdf67b8e/queries/hcl/highlights.scm-; highlights.scm-[- "!"- "\*"- "/"- "%"- "\+"- "-"- ">"- ">="- "<"- "<="- "=="- "!="- "&&"- "||"-] @operator--[- "{"- "}"- "["- "]"- "("- ")"-] @punctuation.bracket--[- "."- ".*"- ","- "[*]"-] @punctuation.delimiter--[- (ellipsis)- "\?"- "=>"-] @punctuation.special--[- ":"- "="-] @punctuation--[- "for"- "endfor"- "in"- "if"- "else"- "endif"-] @keyword--[- (quoted_template_start) ; "- (quoted_template_end) ; "- (template_literal) ; non-interpolation/directive content-] @string--[- (heredoc_identifier) ; END- (heredoc_start) ; << or <<--] @punctuation.delimiter--[- (template_interpolation_start) ; ${- (template_interpolation_end) ; }- (template_directive_start) ; %{- (template_directive_end) ; }- (strip_marker) ; ~-] @punctuation.special--(numeric_lit) @number--(bool_lit) @boolean--(null_lit) @constant--(comment) @comment--(identifier) @variable--(body- (block- (identifier) @keyword))--(body- (block- (body- (block- (identifier) @type))))--(function_call- (identifier) @function)--(attribute- (identifier) @variable)--; { key: val }-;-; highlight identifier keys as though they were block attributes-(object_elem- key:- (expression- (variable_expr- (identifier) @variable)))--; var.foo, data.bar-;-; first element in get_attr is a variable.builtin or a reference to a variable.builtin-(expression- (variable_expr- (identifier) @variable)- (get_attr- (identifier) @variable))diff --git a/extensions/terraform/languages/hcl/indents.scm b/extensions/terraform/languages/hcl/indents.scmdeleted file mode 100644index be12af1d0cd..00000000000--- a/extensions/terraform/languages/hcl/indents.scm+++ /dev/null@@ -1,13 +0,0 @@-; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/hcl/indents.scm-[- (block)- (object)- (tuple)- (function_call)-] @indent--[- "]"- "}"- ")"-] @outdentdiff --git a/extensions/terraform/languages/hcl/injections.scm b/extensions/terraform/languages/hcl/injections.scmdeleted file mode 100644index f06f6b970c4..00000000000--- a/extensions/terraform/languages/hcl/injections.scm+++ /dev/null@@ -1,6 +0,0 @@-; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/hcl/injections.scm--(heredoc_template- (template_literal) @injection.content- (heredoc_identifier) @injection.language- (#downcase! @injection.language))diff --git a/extensions/terraform/languages/hcl/outline.scm b/extensions/terraform/languages/hcl/outline.scmdeleted file mode 100644index 0dc3abc93d1..00000000000--- a/extensions/terraform/languages/hcl/outline.scm+++ /dev/null@@ -1,74 +0,0 @@-; HCL Outline Scheme-; Comments-(comment) @annotation--; Block with and without string_lit-; Example:-; terraform { ... }-; module "vpc" { ... }-; resource "resource" "name" { ... }-(config_file- (body- (block- (identifier) @context- ) @item- )-)--; Inside block with identifier-(config_file- (body- (block- (identifier)- (body- (attribute- (identifier) @context- ) @item- )- )- )-)--; Inside block with identifier and string_lit-(config_file- (body- (block- (identifier)- (body- (block- (identifier) @context- (string_lit)? @name- ) @item- )- )- )-)--; Root Attribute block-; Example:-; inputs = { ... }-(config_file- (body- (attribute- (identifier) @context- ) @item- )-)--; Inside Root Attribute block-(config_file- (body- (attribute- (identifier)- (expression- (collection_value- (object- (object_elem- key: (expression (variable_expr (identifier) @context))- ) @item- )- )- )- )- )-)diff --git a/extensions/terraform/languages/terraform-vars/brackets.scm b/extensions/terraform/languages/terraform-vars/brackets.scmdeleted file mode 100644index eff2faad54c..00000000000--- a/extensions/terraform/languages/terraform-vars/brackets.scm+++ /dev/null@@ -1,5 +0,0 @@-("(" @open ")" @close)-("[" @open "]" @close)-("{" @open "}" @close)-((block_start) @open (block_end) @close)-((tuple_start) @open (tuple_end) @close)diff --git a/extensions/terraform/languages/terraform-vars/config.toml b/extensions/terraform/languages/terraform-vars/config.tomldeleted file mode 100644index 4d803ee36e9..00000000000--- a/extensions/terraform/languages/terraform-vars/config.toml+++ /dev/null@@ -1,15 +0,0 @@-name = "Terraform Vars"-grammar = "hcl"-path_suffixes = ["tfvars"]-line_comments = ["# ", "// "]-block_comment = ["/*", "*/"]-autoclose_before = ",}])"-brackets = [- { start = "{", end = "}", close = true, newline = true },- { start = "[", end = "]", close = true, newline = true },- { start = "(", end = ")", close = true, newline = true },- { start = "\"", end = "\"", close = true, newline = false, not_in = ["comment", "string"] },- { start = "'", end = "'", close = true, newline = false, not_in = ["comment", "string"] },- { start = "/*", end = " */", close = true, newline = false, not_in = ["comment", "string"] },-]-tab_size = 2diff --git a/extensions/terraform/languages/terraform-vars/highlights.scm b/extensions/terraform/languages/terraform-vars/highlights.scmdeleted file mode 100644index ca39758ba68..00000000000--- a/extensions/terraform/languages/terraform-vars/highlights.scm+++ /dev/null@@ -1,159 +0,0 @@-; https://github.com/nvim-treesitter/nvim-treesitter/blob/cb79d2446196d25607eb1d982c96939abdf67b8e/queries/hcl/highlights.scm-; highlights.scm-[- "!"- "\*"- "/"- "%"- "\+"- "-"- ">"- ">="- "<"- "<="- "=="- "!="- "&&"- "||"-] @operator--[- "{"- "}"- "["- "]"- "("- ")"-] @punctuation.bracket--[- "."- ".*"- ","- "[*]"-] @punctuation.delimiter--[- (ellipsis)- "\?"- "=>"-] @punctuation.special--[- ":"- "="-] @punctuation--[- "for"- "endfor"- "in"- "if"- "else"- "endif"-] @keyword--[- (quoted_template_start) ; "- (quoted_template_end) ; "- (template_literal) ; non-interpolation/directive content-] @string--[- (heredoc_identifier) ; END- (heredoc_start) ; << or <<--] @punctuation.delimiter--[- (template_interpolation_start) ; ${- (template_interpolation_end) ; }- (template_directive_start) ; %{- (template_directive_end) ; }- (strip_marker) ; ~-] @punctuation.special--(numeric_lit) @number--(bool_lit) @boolean--(null_lit) @constant--(comment) @comment--(identifier) @variable--(body- (block- (identifier) @keyword))--(body- (block- (body- (block- (identifier) @type))))--(function_call- (identifier) @function)--(attribute- (identifier) @variable)--; { key: val }-;-; highlight identifier keys as though they were block attributes-(object_elem- key:- (expression- (variable_expr- (identifier) @variable)))--; var.foo, data.bar-;-; first element in get_attr is a variable.builtin or a reference to a variable.builtin-(expression- (variable_expr- (identifier) @variable)- (get_attr- (identifier) @variable))--; https://github.com/nvim-treesitter/nvim-treesitter/blob/cb79d2446196d25607eb1d982c96939abdf67b8e/queries/terraform/highlights.scm-; Terraform specific references-;-;-; local/module/data/var/output-(expression- (variable_expr- (identifier) @variable- (#any-of? @variable "data" "var" "local" "module" "output"))- (get_attr- (identifier) @variable))--; path.root/cwd/module-(expression- (variable_expr- (identifier) @type- (#eq? @type "path"))- (get_attr- (identifier) @variable- (#any-of? @variable "root" "cwd" "module")))--; terraform.workspace-(expression- (variable_expr- (identifier) @type- (#eq? @type "terraform"))- (get_attr- (identifier) @variable- (#any-of? @variable "workspace")))--; Terraform specific keywords-; TODO: ideally only for identifiers under a `variable` block to minimize false positives-((identifier) @type- (#any-of? @type "bool" "string" "number" "object" "tuple" "list" "map" "set" "any"))--(object_elem- val:- (expression- (variable_expr- (identifier) @type- (#any-of? @type "bool" "string" "number" "object" "tuple" "list" "map" "set" "any"))))diff --git a/extensions/terraform/languages/terraform-vars/indents.scm b/extensions/terraform/languages/terraform-vars/indents.scmdeleted file mode 100644index b9ba0ad56a3..00000000000--- a/extensions/terraform/languages/terraform-vars/indents.scm+++ /dev/null@@ -1,16 +0,0 @@-; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/hcl/indents.scm-[- (block)- (object)- (tuple)- (function_call)-] @indent--[- "]"- "}"- ")"-] @outdent--; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/terraform/indents.scm-; inherits: hcldiff --git a/extensions/terraform/languages/terraform-vars/injections.scm b/extensions/terraform/languages/terraform-vars/injections.scmdeleted file mode 100644index 49e7d8d3251..00000000000--- a/extensions/terraform/languages/terraform-vars/injections.scm+++ /dev/null@@ -1,9 +0,0 @@-; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/hcl/injections.scm--(heredoc_template- (template_literal) @injection.content- (heredoc_identifier) @injection.language- (#downcase! @injection.language))--; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/terraform/injections.scm-; inherits: hcldiff --git a/extensions/terraform/languages/terraform/brackets.scm b/extensions/terraform/languages/terraform/brackets.scmdeleted file mode 100644index eff2faad54c..00000000000--- a/extensions/terraform/languages/terraform/brackets.scm+++ /dev/null@@ -1,5 +0,0 @@-("(" @open ")" @close)-("[" @open "]" @close)-("{" @open "}" @close)-((block_start) @open (block_end) @close)-((tuple_start) @open (tuple_end) @close)diff --git a/extensions/terraform/languages/terraform/config.toml b/extensions/terraform/languages/terraform/config.tomldeleted file mode 100644index cfb27f4cc23..00000000000--- a/extensions/terraform/languages/terraform/config.toml+++ /dev/null@@ -1,15 +0,0 @@-name = "Terraform"-grammar = "hcl"-path_suffixes = ["tf"]-line_comments = ["# ", "// "]-block_comment = ["/*", "*/"]-autoclose_before = ",}])"-brackets = [- { start = "{", end = "}", close = true, newline = true },- { start = "[", end = "]", close = true, newline = true },- { start = "(", end = ")", close = true, newline = true },- { start = "\"", end = "\"", close = true, newline = false, not_in = ["comment", "string"] },- { start = "'", end = "'", close = true, newline = false, not_in = ["comment", "string"] },- { start = "/*", end = " */", close = true, newline = false, not_in = ["comment", "string"] },-]-tab_size = 2diff --git a/extensions/terraform/languages/terraform/highlights.scm b/extensions/terraform/languages/terraform/highlights.scmdeleted file mode 100644index ca39758ba68..00000000000--- a/extensions/terraform/languages/terraform/highlights.scm+++ /dev/null@@ -1,159 +0,0 @@-; https://github.com/nvim-treesitter/nvim-treesitter/blob/cb79d2446196d25607eb1d982c96939abdf67b8e/queries/hcl/highlights.scm-; highlights.scm-[- "!"- "\*"- "/"- "%"- "\+"- "-"- ">"- ">="- "<"- "<="- "=="- "!="- "&&"- "||"-] @operator--[- "{"- "}"- "["- "]"- "("- ")"-] @punctuation.bracket--[- "."- ".*"- ","- "[*]"-] @punctuation.delimiter--[- (ellipsis)- "\?"- "=>"-] @punctuation.special--[- ":"- "="-] @punctuation--[- "for"- "endfor"- "in"- "if"- "else"- "endif"-] @keyword--[- (quoted_template_start) ; "- (quoted_template_end) ; "- (template_literal) ; non-interpolation/directive content-] @string--[- (heredoc_identifier) ; END- (heredoc_start) ; << or <<--] @punctuation.delimiter--[- (template_interpolation_start) ; ${- (template_interpolation_end) ; }- (template_directive_start) ; %{- (template_directive_end) ; }- (strip_marker) ; ~-] @punctuation.special--(numeric_lit) @number--(bool_lit) @boolean--(null_lit) @constant--(comment) @comment--(identifier) @variable--(body- (block- (identifier) @keyword))--(body- (block- (body- (block- (identifier) @type))))--(function_call- (identifier) @function)--(attribute- (identifier) @variable)--; { key: val }-;-; highlight identifier keys as though they were block attributes-(object_elem- key:- (expression- (variable_expr- (identifier) @variable)))--; var.foo, data.bar-;-; first element in get_attr is a variable.builtin or a reference to a variable.builtin-(expression- (variable_expr- (identifier) @variable)- (get_attr- (identifier) @variable))--; https://github.com/nvim-treesitter/nvim-treesitter/blob/cb79d2446196d25607eb1d982c96939abdf67b8e/queries/terraform/highlights.scm-; Terraform specific references-;-;-; local/module/data/var/output-(expression- (variable_expr- (identifier) @variable- (#any-of? @variable "data" "var" "local" "module" "output"))- (get_attr- (identifier) @variable))--; path.root/cwd/module-(expression- (variable_expr- (identifier) @type- (#eq? @type "path"))- (get_attr- (identifier) @variable- (#any-of? @variable "root" "cwd" "module")))--; terraform.workspace-(expression- (variable_expr- (identifier) @type- (#eq? @type "terraform"))- (get_attr- (identifier) @variable- (#any-of? @variable "workspace")))--; Terraform specific keywords-; TODO: ideally only for identifiers under a `variable` block to minimize false positives-((identifier) @type- (#any-of? @type "bool" "string" "number" "object" "tuple" "list" "map" "set" "any"))--(object_elem- val:- (expression- (variable_expr- (identifier) @type- (#any-of? @type "bool" "string" "number" "object" "tuple" "list" "map" "set" "any"))))diff --git a/extensions/terraform/languages/terraform/indents.scm b/extensions/terraform/languages/terraform/indents.scmdeleted file mode 100644index b9ba0ad56a3..00000000000--- a/extensions/terraform/languages/terraform/indents.scm+++ /dev/null@@ -1,16 +0,0 @@-; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/hcl/indents.scm-[- (block)- (object)- (tuple)- (function_call)-] @indent--[- "]"- "}"- ")"-] @outdent--; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/terraform/indents.scm-; inherits: hcldiff --git a/extensions/terraform/languages/terraform/injections.scm b/extensions/terraform/languages/terraform/injections.scmdeleted file mode 100644index 49e7d8d3251..00000000000--- a/extensions/terraform/languages/terraform/injections.scm+++ /dev/null@@ -1,9 +0,0 @@-; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/hcl/injections.scm--(heredoc_template- (template_literal) @injection.content- (heredoc_identifier) @injection.language- (#downcase! @injection.language))--; https://github.com/nvim-treesitter/nvim-treesitter/blob/ce4adf11cfe36fc5b0e5bcdce0c7c6e8fbc9798a/queries/terraform/injections.scm-; inherits: hcldiff --git a/extensions/terraform/languages/terraform/outline.scm b/extensions/terraform/languages/terraform/outline.scmdeleted file mode 100644index b50e239afca..00000000000--- a/extensions/terraform/languages/terraform/outline.scm+++ /dev/null@@ -1,76 +0,0 @@-; HCL Outline Scheme-; Comments-(comment) @annotation--; Block with and without string_lit-; Example:-; terraform { ... }-; module "vpc" { ... }-; resource "resource" "name" { ... }-(config_file- (body- (block- (identifier) @context- (string_lit)? @name- (string_lit)? @name- ) @item- )-)--; Inside block with identifier-(config_file- (body- (block- (identifier)- (body- (attribute- (identifier) @context- ) @item- )- )- )-)--; Inside block with identifier and string_lit-(config_file- (body- (block- (identifier)- (body- (block- (identifier) @context- (string_lit)? @name- ) @item- )- )- )-)--; Root Attribute block-; Example:-; inputs = { ... }-(config_file- (body- (attribute- (identifier) @context- ) @item- )-)--; Inside Root Attribute block-(config_file- (body- (attribute- (identifier)- (expression- (collection_value- (object- (object_elem- key: (expression (variable_expr (identifier) @context))- ) @item- )- )- )- )- )-)diff --git a/extensions/terraform/src/terraform.rs b/extensions/terraform/src/terraform.rsdeleted file mode 100644index 213a4392c6d..00000000000--- a/extensions/terraform/src/terraform.rs+++ /dev/null@@ -1,102 +0,0 @@-use std::fs;-use zed::LanguageServerId;-use zed_extension_api::{self as zed, Result};--struct TerraformExtension {- cached_binary_path: Option<String>,-}--impl TerraformExtension {- fn language_server_binary_path(- &mut self,- language_server_id: &LanguageServerId,- worktree: &zed::Worktree,- ) -> Result<String> {- if let Some(path) = worktree.which("terraform-ls") {- return Ok(path);- }-- if let Some(path) = &self.cached_binary_path {- if fs::metadata(path).map_or(false, |stat| stat.is_file()) {- return Ok(path.clone());- }- }-- zed::set_language_server_installation_status(- language_server_id,- &zed::LanguageServerInstallationStatus::CheckingForUpdate,- );- let release = zed::latest_github_release(- "hashicorp/terraform-ls",- zed::GithubReleaseOptions {- require_assets: false,- pre_release: false,- },- )?;-- let (platform, arch) = zed::current_platform();- let download_url = format!(- "https://releases.hashicorp.com/terraform-ls/{version}/terraform-ls_{version}_{os}_{arch}.zip",- version = release.version.strip_prefix('v').unwrap_or(&release.version),- os = match platform {- zed::Os::Mac => "darwin",- zed::Os::Linux => "linux",- zed::Os::Windows => "windows",- },- arch = match arch {- zed::Architecture::Aarch64 => "arm64",- zed::Architecture::X86 => "386",- zed::Architecture::X8664 => "amd64",- },- );-- let version_dir = format!("terraform-ls-{}", release.version);- let binary_path = format!("{version_dir}/terraform-ls");-- if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {- zed::set_language_server_installation_status(- language_server_id,- &zed::LanguageServerInstallationStatus::Downloading,- );-- zed::download_file(&download_url, &version_dir, zed::DownloadedFileType::Zip)- .map_err(|e| format!("failed to download file: {e}"))?;-- zed::make_file_executable(&binary_path)?;-- let entries =- fs::read_dir(".").map_err(|e| format!("failed to list working directory {e}"))?;- for entry in entries {- let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;- if entry.file_name().to_str() != Some(&version_dir) {- fs::remove_dir_all(entry.path()).ok();- }- }- }-- self.cached_binary_path = Some(binary_path.clone());- Ok(binary_path)- }-}--impl zed::Extension for TerraformExtension {- fn new() -> Self {- Self {- cached_binary_path: None,- }- }-- fn language_server_command(- &mut self,- language_server_id: &LanguageServerId,- worktree: &zed::Worktree,- ) -> Result<zed::Command> {- Ok(zed::Command {- command: self.language_server_binary_path(language_server_id, worktree)?,- args: vec!["serve".to_string()],- env: Default::default(),- })- }-}--zed::register_extension!(TerraformExtension);