diff --git a/crates/zed/src/languages.rs b/crates/zed/src/languages.rs index 44c0d85566..825925c07f 100644 --- a/crates/zed/src/languages.rs +++ b/crates/zed/src/languages.rs @@ -28,6 +28,11 @@ pub fn build_language_registry(login_shell_env_loaded: Task<()>) -> LanguageRegi tree_sitter_cpp::language(), Some(Arc::new(c::CLspAdapter) as Arc), ), + ( + "go", + tree_sitter_go::language(), + Some(Arc::new(go::GoLspAdapter) as Arc), + ), ( "json", tree_sitter_json::language(), diff --git a/crates/zed/src/languages/go.rs b/crates/zed/src/languages/go.rs index 24f98b706c..3a4c02446c 100644 --- a/crates/zed/src/languages/go.rs +++ b/crates/zed/src/languages/go.rs @@ -26,6 +26,10 @@ impl super::LspAdapter for GoLspAdapter { LanguageServerName("gopls".into()) } + fn server_args(&self) -> &[&str] { + &["-mode=stdio"] + } + fn fetch_latest_server_version( &self, http: Arc, @@ -99,8 +103,9 @@ impl super::LspAdapter for GoLspAdapter { let version_stdout = str::from_utf8(&version_output.stdout) .map_err(|_| anyhow!("gopls version produced invalid utf8"))?; let version = GOPLS_VERSION_REGEX - .shortest_match(version_stdout) - .ok_or_else(|| anyhow!("failed to parse gopls version output"))?; + .find(version_stdout) + .ok_or_else(|| anyhow!("failed to parse gopls version output"))? + .as_str(); let binary_path = container_dir.join(&format!("gopls_{version}")); fs::rename(&installed_binary_path, &binary_path).await?;