mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Launch gopls with the right arguments
Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
8f4387a252
commit
a41f164ffe
@ -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<dyn LspAdapter>),
|
||||
),
|
||||
(
|
||||
"go",
|
||||
tree_sitter_go::language(),
|
||||
Some(Arc::new(go::GoLspAdapter) as Arc<dyn LspAdapter>),
|
||||
),
|
||||
(
|
||||
"json",
|
||||
tree_sitter_json::language(),
|
||||
|
@ -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<dyn HttpClient>,
|
||||
@ -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?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user