1# Ruby
2
3- Tree Sitter: [tree-sitter-ruby](https://github.com/tree-sitter/tree-sitter-ruby)
4- Language Servers: [solargraph](https://github.com/castwide/solargraph), [ruby-lsp](https://github.com/Shopify/ruby-lsp)
5
6## Choosing a language server
7
8The Ruby extension offers both `solargraph` and `ruby-lsp` language server support.
9
10`solargraph` is enabled by default.
11
12To switch to `ruby-lsp`, add the following to your `settings.json`:
13
14```json
15{
16 "languages": {
17 "Ruby": {
18 "language_servers": ["ruby-lsp", "..."]
19 }
20 }
21}
22```
23
24## Setting up `solargraph`
25
26Zed currently doesn't install Solargraph automatically. To use Solargraph, you need to install the gem. Zed just looks for an executable called `solargraph` on your `PATH`.
27
28You can install the gem manually with the following command:
29
30```shell
31gem install solargraph
32```
33
34Alternatively, if your project uses Bundler, you can add the Solargraph gem to your `Gemfile`:
35
36```ruby
37gem 'solargraph', group: :development
38```
39
40Solargraph has formatting and diagnostics disabled by default. We can tell Zed to enable them by adding the following to your `settings.json`:
41
42```json
43{
44 "lsp": {
45 "solargraph": {
46 "initialization_options": {
47 "diagnostics": true,
48 "formatting": true
49 }
50 }
51 }
52}
53```
54
55### Configuration
56
57Solargraph reads its configuration from a file called `.solargraph.yml` in the root of your project. For more information about this file, see the [Solargraph configuration documentation](https://solargraph.org/guides/configuration).
58
59## Setting up `ruby-lsp`
60
61Zed currently doesn't install Ruby LSP automatically. To use Ruby LSP, you need to install the gem. Zed just looks for an executable called `ruby-lsp` on your `PATH`.
62
63You can install the gem manually with the following command:
64
65```shell
66gem install ruby-lsp
67```
68
69Ruby LSP uses pull-based diagnostics which Zed doesn't support yet. We can tell Zed to disable it by adding the following to your `settings.json`:
70
71```json
72{
73 "lsp": {
74 "ruby-lsp": {
75 "initialization_options": {
76 "enabledFeatures": {
77 "diagnostics": false
78 }
79 }
80 }
81 }
82}
83```