ZIm/extensions
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
..
astro astro: Bump to v0.1.0 (#15172) 2024-07-25 08:16:28 -04:00
clojure clojure: Bump to v0.0.3 (#13935) 2024-07-08 11:29:07 -04:00
csharp csharp: Upgrade zed_extension_api to v0.0.6 (#15175) 2024-07-25 08:26:04 -04:00
dart dart: Release 0.0.3 (#14176) 2024-07-11 11:48:04 +02:00
deno deno: Bump to v0.0.2 (#15173) 2024-07-25 08:19:43 -04:00
elixir elixir: Make start_lexical.sh executable (#14831) 2024-07-19 14:17:04 -04:00
elm Extract Elm language into an extension (#10432) 2024-04-11 10:23:49 -07:00
emmet emmet: Upgrade zed_extension_api to v0.0.6 (#15177) 2024-07-25 08:34:45 -04:00
erlang erlang: Add support for installing elp language server (#14923) 2024-07-21 12:42:21 -04:00
gleam gleam: Update Tree-sitter grammar for label shorthand syntax (#15659) 2024-08-01 17:46:23 -04:00
glsl glsl: Bump to v0.1.0 (#10734) 2024-04-18 11:57:21 -04:00
haskell haskell: Update author name (#13268) 2024-06-19 10:28:49 -04:00
html html: Bump to 0.1.1 (#12093) 2024-05-21 18:36:47 +02:00
lua lua: Bump to v0.0.3 (#13882) 2024-07-05 14:17:53 -04:00
ocaml ocaml: Bump to v0.0.2 (#13864) 2024-07-05 10:10:54 -04:00
php php: Bump to v0.1.2 (#14808) 2024-07-19 09:13:23 -04:00
prisma prisma: Upgrade zed_extension_api to v0.0.6 (#15180) 2024-07-25 08:46:17 -04:00
purescript purescript: Upgrade zed_extension_api to v0.0.6 (#15181) 2024-07-25 08:55:16 -04:00
racket Clean up whitespace (#10755) 2024-04-23 13:31:21 -04:00
ruby ruby: Support "binary" settings for Rubocop and Solargraph (#15110) 2024-08-06 08:36:14 -04:00
ruff Add link to docs for configuring ruff 2024-08-02 11:06:01 -04:00
scheme Clean up whitespace (#10755) 2024-04-23 13:31:21 -04:00
snippets snippets: Release 0.0.5 (#13434) 2024-06-24 00:39:42 +02:00
svelte svelte: Bump to v0.0.3 (#14650) 2024-07-17 10:20:50 -04:00
terraform terraform: Bump to v0.0.4 (#15174) 2024-07-25 08:22:28 -04:00
test-extension Use a dedicated test extension in extension tests (#13781) 2024-07-03 11:10:51 -04:00
toml Auto detect some DSLs (#14693) 2024-07-18 04:38:44 +00:00
uiua uiua: Upgrade zed_extension_api to v0.0.6 (#15240) 2024-07-25 20:43:15 -04:00
vue vue: Bump to v0.1.0 (#14748) 2024-07-18 11:39:30 -04:00
zig zig: Bump to v0.1.5 (#15203) 2024-07-25 11:36:50 -04:00
.gitignore Provide wasm extensions with APIs needed for using pre-installed LSP binaries (#9085) 2024-03-08 17:18:06 -05:00