Or, conversely, you can disable `ruby-lsp` and enable `solargraph` and `rubocop` by adding the following to your `settings.json`:
```json
{
"languages": {
"Ruby": {
"language_servers": ["solargraph", "rubocop", "!ruby-lsp", "..."]
}
}
}
```
## Setting up `solargraph`
Solargraph has formatting and diagnostics disabled by default. We can tell Zed to enable them by adding the following to your `settings.json`:
```json
{
"lsp": {
"solargraph": {
"initialization_options": {
"diagnostics": true,
"formatting": true
}
}
}
}
```
### Configuration
Solargraph 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).
## Setting up `ruby-lsp`
Ruby 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`:
```json
{
"languages": {
"Ruby": {
"language_servers": ["ruby-lsp", "!solargraph", "..."]
}
},
"lsp": {
"ruby-lsp": {
"initialization_options": {
"enabledFeatures": {
// This disables diagnostics
"diagnostics": false
}
}
}
}
}
```
LSP `settings` and `initialization_options` can also be project-specific. For example to use [standardrb/standard](https://github.com/standardrb/standard) as a formatter and linter for a particular project, add this to a `.zed/settings.json` inside your project repo:
```json
{
"lsp": {
"ruby-lsp": {
"initialization_options": {
"formatter": "standard",
"linters": ["standard"]
}
}
}
}
```
## Setting up `rubocop` LSP
Rubocop has unsafe autocorrection disabled by default. We can tell Zed to enable it by adding the following to your `settings.json`:
```json
{
"languages": {
"Ruby": {
// Use ruby-lsp as the primary language server and rubocop as the secondary.
"language_servers": ["ruby-lsp", "rubocop", "!solargraph", "..."]
}
},
"lsp": {
"rubocop": {
"initialization_options": {
"safeAutocorrect": false
}
},
"ruby-lsp": {
"initialization_options": {
"enabledFeatures": {
"diagnostics": false
}
}
}
}
}
```
## Using the Tailwind CSS Language Server with Ruby
It's possible to use the [Tailwind CSS Language Server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in Ruby and ERB files.