go: Adjust gopls
path based on OS (#22727)
Based on the python https://github.com/zed-industries/zed/issues/21452 and PR https://github.com/zed-industries/zed/pull/22587 I found the same problem with go on windows. Describe the bug / provide steps to reproduce it Language server error: gopls The system cannot find the file specified. (os error 2) -- stderr-- [ERROR project::lsp_store] Failed to start language server "gopls": The system cannot find the file specified. (os error 2) [ERROR project::lsp_store] server stderr: "" Environment Windows 11 Go Release Notes: - Windows: Fixed `gopls` path construction on Windows 11. --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
parent
c968225b61
commit
5ec924828e
1 changed files with 7 additions and 1 deletions
|
@ -43,6 +43,12 @@ static GO_ESCAPE_SUBTEST_NAME_REGEX: LazyLock<Regex> = LazyLock::new(|| {
|
|||
Regex::new(r#"[.*+?^${}()|\[\]\\]"#).expect("Failed to create GO_ESCAPE_SUBTEST_NAME_REGEX")
|
||||
});
|
||||
|
||||
const BINARY: &str = if cfg!(target_os = "windows") {
|
||||
"gopls.exe"
|
||||
} else {
|
||||
"gopls"
|
||||
};
|
||||
|
||||
#[async_trait(?Send)]
|
||||
impl super::LspAdapter for GoLspAdapter {
|
||||
fn name(&self) -> LanguageServerName {
|
||||
|
@ -164,7 +170,7 @@ impl super::LspAdapter for GoLspAdapter {
|
|||
return Err(anyhow!("failed to install gopls with `go install`. Is `go` installed and in the PATH? Check logs for more information."));
|
||||
}
|
||||
|
||||
let installed_binary_path = gobin_dir.join("gopls");
|
||||
let installed_binary_path = gobin_dir.join(BINARY);
|
||||
let version_output = util::command::new_smol_command(&installed_binary_path)
|
||||
.arg("version")
|
||||
.output()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue