nvim/lsp/ruby_lsp.lua
Simon Lasbrugnas a2e5555c64
fix(lsp)!: actually use the root lsp/ folder and remove
lua/custom/lsp/** configs

This commit removes the need for nvim-lspconfig which is replaced by the
vim.lsp API.

The lsp/ folder is a copy of nvim-lspconfig's lsp/ folder as it makes it
easy to modify LSP configurations on the fly.

Conform: biome has been replaced with oxfmt
2026-02-02 16:16:06 +01:00

33 lines
844 B
Lua

---@brief
---
--- https://shopify.github.io/ruby-lsp/
---
--- This gem is an implementation of the language server protocol specification for
--- Ruby, used to improve editor features.
---
--- Install the gem. There's no need to require it, since the server is used as a
--- standalone executable.
---
--- ```sh
--- gem install ruby-lsp
--- ```
---@type vim.lsp.Config
return {
cmd = function(dispatchers, config)
return vim.lsp.rpc.start(
{ 'ruby-lsp' },
dispatchers,
config and config.root_dir and { cwd = config.cmd_cwd or config.root_dir }
)
end,
filetypes = { 'ruby', 'eruby' },
root_markers = { 'Gemfile', '.git' },
init_options = {
formatter = 'auto',
},
reuse_client = function(client, config)
config.cmd_cwd = config.root_dir
return client.config.cmd_cwd == config.cmd_cwd
end,
}