diff --git a/lua/lazyvim/plugins/extras/lang/ruby.lua b/lua/lazyvim/plugins/extras/lang/ruby.lua index c70e645d..6eb4fce5 100644 --- a/lua/lazyvim/plugins/extras/lang/ruby.lua +++ b/lua/lazyvim/plugins/extras/lang/ruby.lua @@ -1,3 +1,17 @@ +if lazyvim_docs then + -- LSP Server to use for Ruby. + -- Set to "solargraph" to use solargraph instead of ruby_lsp. + vim.g.lazyvim_ruby_lsp = "ruby_lsp" + vim.g.lazyvim_ruby_formatter = "rubocop" +end + +local lsp = vim.g.lazyvim_ruby_lsp or "ruby_lsp" +if vim.fn.has("nvim-0.10") == 0 then + -- ruby_lsp does not work well with Neovim < 0.10 + lsp = vim.g.lazyvim_ruby_lsp or "solargraph" +end +local formatter = vim.g.lazyvim_ruby_formatter or "rubocop" + return { recommended = function() return LazyVim.extras.wants({ @@ -11,12 +25,29 @@ return { }, { "neovim/nvim-lspconfig", + ---@class PluginLspOpts opts = { + ---@type lspconfig.options servers = { - solargraph = {}, + ruby_lsp = { + enabled = lsp == "ruby_lsp", + }, + solargraph = { + enabled = lsp == "solargraph", + }, + rubocop = { + enabled = formatter == "rubocop", + }, + standardrb = { + enabled = formatter == "standardrb", + }, }, }, }, + { + "williamboman/mason.nvim", + opts = { ensure_installed = { "erb-formatter", "erb-lint" } }, + }, { "mfussenegger/nvim-dap", optional = true, @@ -27,6 +58,16 @@ return { end, }, }, + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + ruby = { formatter }, + eruby = { "erb-format" }, + }, + }, + }, { "nvim-neotest/neotest", optional = true,