a0fa8a489bb4af98059e5a064c7fac2a77b49aff
solargraph exists in $PATH or is configured (#10835)
This fixes #9811 by checking for the `solargraph` binary in the `$PATH` as it's setup in the project shell. It also adds support for configuring the path to `solargraph` manually: ```json { "lsp": { "solargraph": { "binary": { "path": "/Users/thorstenball/bin/solargraph", "arguments": ["stdio"] } } } } ``` ## Example Given the following setup: - `ruby@3.3.0` used globally, no `solargraph` installed globally - `ruby@3.2.2` used in a project, `solargraph` installed as binstub in `$project/bin/solargraph`, `.envrc` to configure `direnv` to add `$project/bin` to `$PATH Which looks like this in practice: ```shell # GLOBAL ~ $ ruby --version ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23] ~ $ which solargraph solargraph not found # IN PROJECT ~ $ cd work/projs/rails-proj direnv: loading ~/work/projs/rails-proj/.envrc direnv: export ~PATH ~/work/projs/rails-proj $ ruby --version ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23] ~/work/projs/rails-proj $ which solargraph /Users/thorstenball/work/projs/rails-proj/bin/solargraph ``` The expectation is that Zed, when opening `~/work/projs/rails-proj`, picks up the local `solargraph`. But with **Zed Stable** that doesn't work, as we can see in the logs: ``` 2024-04-22T10:21:37+02:00 [INFO] starting language server. binary path: "solargraph", working directory: "/Users/thorstenball/work/projs/rails-proj", args: ["stdio"] 2024-04-22T10:21:37+02:00 [ERROR] failed to start language server "solargraph": No such file or directory (os error 2) ``` With the change in this PR, it uses `rails/proj/bin/solargraph`: ``` [2024-04-22T10:33:06+02:00 INFO language] found user-installed language server for Ruby. path: "/Users/thorstenball/work/projs/rails-proj/bin/solargraph", arguments: ["stdio"] [2024-04-22T10:33:06+02:00 INFO lsp] starting language server. binary path: "/Users/thorstenball/work/projs/rails-proj/bin/solargraph", working directory: "/Users/thorstenball/work/projs/rails-proj", args: ["stdio"] ``` **NOTE**: depending on whether `mise` (or `rbenv`, `asdf`, `chruby`, ...) or `direnv` come first in the shell-rc file, it picks one or the other, depending on what puts itself first in `$PATH`. ## Release Notes Release Notes: - Added support for finding the Ruby language server `solargraph` in the user's `$PATH` as it is when `cd`ing into a project's directory. ([#9811](https://github.com/zed-industries/zed/issues/9811)) - Added support for configuring the `path` and `arguments` for `solargraph` language server manually. Example from settings: `{"lsp": {"solargraph": {"binary": {"path":"/Users/thorstenball/bin/solargraph","arguments": ["stdio"]}}}}` ([#9811](https://github.com/zed-industries/zed/issues/9811))
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
You can download Zed today for macOS (v10.15+).
Support for additional platforms is on our roadmap:
- Linux (tracking issue)
- Windows (tracking issue)
- Web (tracking issue)
For macOS users, you can also install Zed using Homebrew:
brew install --cask zed
Alternatively, to install the Preview release:
brew tap homebrew/cask-versions
brew install zed-preview
Developing Zed
- Building Zed for macOS
- Building Zed for Linux
- Building Zed for Windows
- Running Collaboration Locally
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Description
Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Readme
586 MiB
Languages
Rust
94.7%
JSON-with-Comments
3.1%
Inno Setup
0.6%
Scheme
0.5%
Shell
0.3%
Other
0.4%