Launch gopls with the right arguments
Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
8f4387a252
commit
a41f164ffe
2 changed files with 12 additions and 2 deletions
|
@ -28,6 +28,11 @@ pub fn build_language_registry(login_shell_env_loaded: Task<()>) -> LanguageRegi
|
||||||
tree_sitter_cpp::language(),
|
tree_sitter_cpp::language(),
|
||||||
Some(Arc::new(c::CLspAdapter) as Arc<dyn LspAdapter>),
|
Some(Arc::new(c::CLspAdapter) as Arc<dyn LspAdapter>),
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"go",
|
||||||
|
tree_sitter_go::language(),
|
||||||
|
Some(Arc::new(go::GoLspAdapter) as Arc<dyn LspAdapter>),
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"json",
|
"json",
|
||||||
tree_sitter_json::language(),
|
tree_sitter_json::language(),
|
||||||
|
|
|
@ -26,6 +26,10 @@ impl super::LspAdapter for GoLspAdapter {
|
||||||
LanguageServerName("gopls".into())
|
LanguageServerName("gopls".into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn server_args(&self) -> &[&str] {
|
||||||
|
&["-mode=stdio"]
|
||||||
|
}
|
||||||
|
|
||||||
fn fetch_latest_server_version(
|
fn fetch_latest_server_version(
|
||||||
&self,
|
&self,
|
||||||
http: Arc<dyn HttpClient>,
|
http: Arc<dyn HttpClient>,
|
||||||
|
@ -99,8 +103,9 @@ impl super::LspAdapter for GoLspAdapter {
|
||||||
let version_stdout = str::from_utf8(&version_output.stdout)
|
let version_stdout = str::from_utf8(&version_output.stdout)
|
||||||
.map_err(|_| anyhow!("gopls version produced invalid utf8"))?;
|
.map_err(|_| anyhow!("gopls version produced invalid utf8"))?;
|
||||||
let version = GOPLS_VERSION_REGEX
|
let version = GOPLS_VERSION_REGEX
|
||||||
.shortest_match(version_stdout)
|
.find(version_stdout)
|
||||||
.ok_or_else(|| anyhow!("failed to parse gopls version output"))?;
|
.ok_or_else(|| anyhow!("failed to parse gopls version output"))?
|
||||||
|
.as_str();
|
||||||
let binary_path = container_dir.join(&format!("gopls_{version}"));
|
let binary_path = container_dir.join(&format!("gopls_{version}"));
|
||||||
fs::rename(&installed_binary_path, &binary_path).await?;
|
fs::rename(&installed_binary_path, &binary_path).await?;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue