zed/crates/project/Cargo.toml
Thorsten Ball 42ac9880c6
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>
2024-02-23 13:39:14 +01:00

89 lines
2.2 KiB
TOML

[package]
name = "project"
version = "0.1.0"
edition = "2021"
publish = false
license = "GPL-3.0-or-later"
[lib]
path = "src/project.rs"
doctest = false
[features]
test-support = [
"client/test-support",
"db/test-support",
"language/test-support",
"settings/test-support",
"text/test-support",
"prettier/test-support",
"gpui/test-support",
]
[dependencies]
aho-corasick = "1.1"
anyhow.workspace = true
async-trait.workspace = true
backtrace = "0.3"
client.workspace = true
clock.workspace = true
collections.workspace = true
copilot.workspace = true
db.workspace = true
fs.workspace = true
fsevent.workspace = true
futures.workspace = true
fuzzy.workspace = true
git.workspace = true
globset.workspace = true
gpui.workspace = true
ignore = "0.4"
itertools = "0.10"
language.workspace = true
lazy_static.workspace = true
log.workspace = true
lsp.workspace = true
node_runtime.workspace = true
parking_lot.workspace = true
postage.workspace = true
prettier.workspace = true
rand.workspace = true
regex.workspace = true
rpc.workspace = true
task.workspace = true
schemars.workspace = true
serde.workspace = true
serde_derive.workspace = true
serde_json.workspace = true
settings.workspace = true
sha2 = "0.10"
similar = "1.3"
smol.workspace = true
sum_tree.workspace = true
terminal.workspace = true
text.workspace = true
thiserror.workspace = true
toml.workspace = true
util.workspace = true
which.workspace = true
[dev-dependencies]
client = { workspace = true, features = ["test-support"] }
collections = { workspace = true, features = ["test-support"] }
ctor.workspace = true
db = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
fs = { workspace = true, features = ["test-support"] }
git2.workspace = true
gpui = { workspace = true, features = ["test-support"] }
language = { workspace = true, features = ["test-support"] }
release_channel.workspace = true
lsp = { workspace = true, features = ["test-support"] }
prettier = { workspace = true, features = ["test-support"] }
pretty_assertions.workspace = true
rpc = { workspace = true, features = ["test-support"] }
settings = { workspace = true, features = ["test-support"] }
tempfile.workspace = true
unindent.workspace = true
util = { workspace = true, features = ["test-support"] }