From 2f4375f38e36d693aef80664873ab9908fd0602a Mon Sep 17 00:00:00 2001 From: Kevin Robayna Date: Thu, 18 Jul 2024 22:50:20 +0100 Subject: [PATCH] update config to enable user to configure lsp/formatter This makes it possible to configure ruby lsp and formatter without overriding the lsp config! --- lua/lazyvim/plugins/extras/lang/ruby.lua | 26 +++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/ruby.lua b/lua/lazyvim/plugins/extras/lang/ruby.lua index c8464099..b81109bf 100644 --- a/lua/lazyvim/plugins/extras/lang/ruby.lua +++ b/lua/lazyvim/plugins/extras/lang/ruby.lua @@ -1,3 +1,13 @@ +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" +local formatter = vim.g.lazyvim_ruby_formatter or "rubocop" + return { recommended = function() return LazyVim.extras.wants({ @@ -15,12 +25,18 @@ return { opts = { ---@type lspconfig.options servers = { - -- disable solargraph from auto running when you open ruby files - solargraph = { - autostart = false, + ruby_lsp = { + enabled = lsp == "ruby_lsp", + }, + solargraph = { + enabled = lsp == "solargraph", + }, + rubocop = { + enabled = formatter == "rubocop", + }, + standardrb = { + enabled = formatter == "standardrb", }, - -- ruby_lsp will be automatically installed with mason and loaded with lspconfig - ruby_lsp = {}, }, }, },