Prevent LSP errors on startup

This commit is contained in:
Marcelo Jacobus 2024-08-20 10:18:11 -03:00
parent c57404aac3
commit 4a59c83ba1

View file

@ -4,8 +4,9 @@ require("config.lazy")
-- init.lua
local lspconfig = require("lspconfig")
-- Setup Ruby Language Server
lspconfig.ruby_ls.setup({
if lspconfig and lspconfig.ruby_ls and lspconfig.ruby_ls.setup then
-- Setup Ruby Language Server
lspconfig.ruby_ls.setup({
cmd = { "ruby-lsp" },
filetypes = { "ruby" },
settings = {
@ -14,10 +15,12 @@ lspconfig.ruby_ls.setup({
completion = true,
},
},
})
})
end
-- Setup Solargraph
lspconfig.solargraph.setup({
if lspconfig and lspconfig.solargraph and lspconfig.solargraph.setup then
-- Setup Solargraph
lspconfig.solargraph.setup({
cmd = { "solargraph", "stdio" },
filetypes = { "ruby" },
settings = {
@ -25,7 +28,8 @@ lspconfig.solargraph.setup({
diagnostics = true,
},
},
})
})
end
-- vim.defer_fn(function()
-- vim.cmd([[highlight Comment guifg=#222436 guibg=#5c5e77 gui=italic]])