disable rubocop and formatting in solargraph, add standardrb glue

Sun, 05 Mar 2023 15:14:03 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 05 Mar 2023 15:14:03 -0500
changeset 1059
dc0095e5bbc8
parent 1058
c8754b0414b9
child 1060
c20cb89a2ee9

disable rubocop and formatting in solargraph, add standardrb glue

.config/nvim/lua/config/lsp.lua file | annotate | diff | comparison | revisions
.config/nvim/lua/plugins/lsp.lua file | annotate | diff | comparison | revisions
.config/solargraph/config.yml file | annotate | diff | comparison | revisions
--- a/.config/nvim/lua/config/lsp.lua
+++ b/.config/nvim/lua/config/lsp.lua
@@ -39,6 +39,28 @@ vim.api.nvim_create_autocmd("LspAttach",
         })
       end,
     })
-
   end
 })
+
+-- This can be removed when mason-lspconfig gets support for standardrb
+if vim.fn.executable("standardrb") == 1 then
+  local lsp_ruby = vim.api.nvim_create_augroup("lsp_ruby", {clear = true})
+
+  vim.api.nvim_create_autocmd("FileType", {
+    pattern = "ruby",
+    group = lsp_ruby,
+    once = true,
+    callback = function()
+      require("lspconfig").standardrb.setup({})
+    end,
+  })
+
+  vim.api.nvim_create_autocmd("FileType", {
+    pattern = "ruby",
+    group = lsp_ruby,
+    callback = function()
+      vim.cmd.LspStart("standardrb")
+    end,
+  })
+end
+
--- a/.config/nvim/lua/plugins/lsp.lua
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -18,7 +18,13 @@ return {
             capabilities = require('cmp_nvim_lsp').default_capabilities(),
             settings = { gopls = { gofumpt = true } }
           })
-        end
+        end,
+        solargraph = function ()
+          require("lspconfig").solargraph.setup({
+            capabilities = require('cmp_nvim_lsp').default_capabilities(),
+            init_options = { formatting = false }
+          })
+        end,
       })
     end,
   },
new file mode 100644
--- /dev/null
+++ b/.config/solargraph/config.yml
@@ -0,0 +1,2 @@
+# disable rubocop so we can load standardrb lsp
+reporters: []

mercurial