Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Find a file
Vitaly Slobodin 1c3f303594
ruby: Support "binary" settings for Rubocop and Solargraph (#15110)
Hello, this pull request adds support for specifying and using the
"binary" settings for Rubocop and Solargraph LSPs. AFAIK, Ruby LSP does
not require the bundler context but that could be added later easily.

In Ruby world, like in Node.js world, almost all
projects rely on project specific packages (gems) and their versions.
Solargraph and Rubocop gems are usually installed as project
dependencies. Attempting to use global installation of them fail in most
cases due to incompatible or missing dependencies (gems).

To avoid that, Ruby engineers have the `bundler`
gem that provides the `exec` command. This command executes the given
command in the context of the bundle.

This pull request adds support for pulling the `binary` settings to use
them in starting both LSPs. For instance, to start the Solargraph gem in
the context of the bundler, the end user must configure the binary
settings in the folder-specific settings file like so:

```json
{
  "lsp": {
    "solargraph": {
      "binary": {
        "path": "/Users/vslobodin/Development/festivatica/bin/rubocop"
      }
    }
  }
}
```

The `path` key must be an absolute path to the `binstub` of the
`solargraph` gem. The same applies to the "rubocop" gem. Side note but
it would be awesome to use Zed specific environment variables to make
this a bit easier. For instance, we could use the `ZED_WORKTREE_ROOT`
environment variable:

```json
{
  "lsp": {
    "solargraph": {
      "binary": {
        "path": "${ZED_WORKTREE_ROOT}/bin/rubocop"
      }
    }
  }
}
```

But this is out of the scope of this pull request. The code is a bit
messy and repeatable in some places, I am happy to improve it here or
later.

References:
- https://bundler.io/v2.4/man/bundle-exec.1.html
- https://solargraph.org/guides/troubleshooting
- https://bundler.io/v2.5/man/bundle-binstubs.1.html

This pull request is based on these two pull requests:

- https://github.com/zed-industries/zed/pull/14655
- https://github.com/zed-industries/zed/issues/15001

Closes https://github.com/zed-industries/zed/issues/5109.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-06 08:36:14 -04:00
.cargo
.cloudflare
.config
.github Upgrade pnpm/action-setup to v4.0.0 (#15427) 2024-07-29 09:06:19 -04:00
.zed
assets lsp: Support Goto Declaration (#15785) 2024-08-06 11:20:51 +02:00
crates Add menu item to switch Supermaven and Copilot (#15443) 2024-08-06 13:54:30 +02:00
docs ruby: Support "binary" settings for Rubocop and Solargraph (#15110) 2024-08-06 08:36:14 -04:00
extensions ruby: Support "binary" settings for Rubocop and Solargraph (#15110) 2024-08-06 08:36:14 -04:00
script
tooling/xtask
.dockerignore
.git-blame-ignore-revs
.gitattributes
.gitignore Add the ability to store secret dev-only env vars in .env.secret.toml (#15557) 2024-07-31 12:41:09 -07:00
.mailmap
Cargo.lock blade: Update to pick up Intel memory coherency fix & fix calling blade params (#15829) 2024-08-06 11:33:18 +02:00
Cargo.toml blade: Update to pick up Intel memory coherency fix & fix calling blade params (#15829) 2024-08-06 11:33:18 +02:00
CODE_OF_CONDUCT.md
compose.yml
CONTRIBUTING.md
debug.plist
docker-compose.sql
Dockerfile
flake.lock
flake.nix
LICENSE-AGPL
LICENSE-APACHE
LICENSE-GPL
livekit.yaml
Procfile Refactor: Restructure collab main function to prepare for new subcommand: serve llm (#15824) 2024-08-05 12:07:38 -07:00
README.md
renovate.json
rust-toolchain.toml
shell.nix
typos.toml collab: Rework Stripe event processing (#15510) 2024-07-30 16:35:11 -04:00

Zed

CI

Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.


Installation

Packaging status

On macOS and Linux you can download Zed directly or install Zed via your local package manager.

Other platforms are not yet available:

Developing Zed

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 specified error for a crate you've created? If so, add publish = false under [package] in your crate's Cargo.toml.
  • Is the error failed to satisfy license requirements for 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 the accepted array in script/licenses/zed-licenses.toml.
  • Is cargo-about unable to find the license for a dependency? If so, add a clarification field at the end of script/licenses/zed-licenses.toml, as specified in the cargo-about book.