From a099cdaf977beb3517afdfcee2057fc70b870ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20=C3=98stermark?= Date: Sat, 10 May 2025 13:42:57 +0200 Subject: [PATCH] add ruby lsp as ruby server option --- modules/plugins/languages/ruby.nix | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/modules/plugins/languages/ruby.nix b/modules/plugins/languages/ruby.nix index ab0e0905..5d6a151e 100644 --- a/modules/plugins/languages/ruby.nix +++ b/modules/plugins/languages/ruby.nix @@ -9,6 +9,8 @@ inherit (lib.meta) getExe; inherit (lib.modules) mkIf mkMerge; inherit (lib.nvim.types) mkGrammarOption diagnostics; + inherit (lib.nvim.lua) expToLua; + inherit (lib.lists) isList; inherit (lib.types) either listOf package str enum; cfg = config.vim.languages.ruby; @@ -24,10 +26,28 @@ flags = { debounce_text_changes = 150, }, - cmd = { "${pkgs.solargraph}/bin/solargraph", "stdio" } + cmd = ${ + if isList cfg.lsp.package + then expToLua cfg.lsp.package + else ''{ "${cfg.lsp.package}/bin/solargraph", "stdio" }'' + } } ''; }; + rubylsp = { + package = pkgs.ruby-lsp; + lspConfig = '' + lspconfig.ruby_lsp.setup { + capabilities = capabilities, + on_attach = default_on_attach, + cmd = ${ + if isList cfg.lsp.package + then expToLua cfg.lsp.package + else ''{ "${cfg.lsp.package}/bin/ruby-lsp" }'' + } + } + ''; + } }; # testing