# Detect and possibly use user-installed \`gopls\` / \`zls\` language servers \(\#8188\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/42ac9880c6f1d854d2dfe8b668c2ffd5dd317537)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 42ac9880c6f1d854d2dfe8b668c2ffd5dd317537

Requested commit: 42ac9880c6f1d854d2dfe8b668c2ffd5dd317537

Commit: 42ac9880c6f1d854d2dfe8b668c2ffd5dd317537

Tree: 83951e0e81dda136158fec48fc7fd09ab274fce3

Author: Thorsten Ball

Committer: GitHub

## Message

````
Detect and possibly use user-installed `gopls` / `zls` language servers (#8188)

After a lot of back-and-forth, this is a small attempt to implement
solutions (1) and (3) in
https://github.com/zed-industries/zed/issues/7902. The goal is to have a
minimal change that helps users get started with Zed, until we have
extensions ready.

Release Notes:

- Added detection of user-installed `gopls` to Go language server
adapter. If a user has `gopls` in `$PATH` when opening a worktree, it
will be used.
- Added detection of user-installed `zls` to Zig language server
adapter. If a user has `zls` in `$PATH` when opening a worktree, it will
be used.

Example:

I don't have `go` installed globally, but I do have `gopls`:

```
~ $ which go
go not found
~ $ which gopls
/Users/thorstenball/code/go/bin/gopls
```

But I do have `go` in a project's directory:

```
~/tmp/go-testing φ which go
/Users/thorstenball/.local/share/mise/installs/go/1.21.5/go/bin/go
~/tmp/go-testing φ which gopls
/Users/thorstenball/code/go/bin/gopls
```

With current Zed when I run `zed ~/tmp/go-testing`, I'd get the dreaded
error:

![screenshot-2024-02-23-11 14
08@2x](https://github.com/zed-industries/zed/assets/1185253/822ea59b-c63e-4102-a50e-75501cc4e0e3)

But with the changes in this PR, it works:

```
[2024-02-23T11:14:42+01:00 INFO  language::language_registry] starting language server "gopls", path: "/Users/thorstenball/tmp/go-testing", id: 1
[2024-02-23T11:14:42+01:00 INFO  language::language_registry] found user-installed language server for Go. path: "/Users/thorstenball/code/go/bin/gopls", arguments: ["-mode=stdio"]
[2024-02-23T11:14:42+01:00 INFO  lsp] starting language server. binary path: "/Users/thorstenball/code/go/bin/gopls", working directory: "/Users/thorstenball/tmp/go-testing", args: ["-mode=stdio"]
```

---------

Co-authored-by: Antonio <antonio@zed.dev>
````

## Parents

- [65318cb6acc2e36fa7231967f821fec188285f44](https://git.cafe/gitcafe/zed/commit/65318cb6acc2e36fa7231967f821fec188285f44?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/42ac9880c6f1d854d2dfe8b668c2ffd5dd317537?format=markdown)
