91 lines
2.3 KiB
Lua
91 lines
2.3 KiB
Lua
require("mason").setup()
|
|
require("mason-lspconfig").setup()
|
|
require("mason-lspconfig").setup_handlers({
|
|
function (server_name) -- default handler (optional)
|
|
if server_name == 'sumneko_lua' then
|
|
require("lspconfig")[server_name].setup {
|
|
capabilities = capabilities,
|
|
settings = {
|
|
Lua = {
|
|
diagnostics = {
|
|
globals = {'vim'}
|
|
},
|
|
runtime = {
|
|
version = "LuaJIT",
|
|
path = vim.split(package.path, ";")
|
|
},
|
|
workspace = {
|
|
library = {
|
|
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
|
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true
|
|
}
|
|
}
|
|
}
|
|
},
|
|
}
|
|
else
|
|
require("lspconfig")[server_name].setup {
|
|
capabilities = capabilities,
|
|
}
|
|
end
|
|
end,
|
|
})
|
|
|
|
require('mason-nvim-dap').setup()
|
|
|
|
|
|
local rt_config = {
|
|
server = {
|
|
settings = {
|
|
on_attach = function(_, bufnr)
|
|
-- Hover actions
|
|
vim.keymap.set("n", "<C-space>", rt_config.hover_actions.hover_actions, { buffer = bufnr })
|
|
-- Code action groups
|
|
vim.keymap.set("n", "<Leader>a", rt_config.code_action_group.code_action_group, { buffer = bufnr })
|
|
require 'illuminate'.on_attach(client)
|
|
end,
|
|
["rust-analyzer"] = {
|
|
checkOnSave = {
|
|
command = "clippy"
|
|
},
|
|
},
|
|
}
|
|
},
|
|
}
|
|
|
|
require('rust-tools').setup()
|
|
|
|
-- LSP Diagnostics Options Setup
|
|
local sign = function(opts)
|
|
vim.fn.sign_define(opts.name, {
|
|
texthl = opts.name,
|
|
text = opts.text,
|
|
numhl = ''
|
|
})
|
|
end
|
|
|
|
sign({name = 'DiagnosticSignError', text = ''})
|
|
sign({name = 'DiagnosticSignWarn', text = ''})
|
|
sign({name = 'DiagnosticSignHint', text = ''})
|
|
sign({name = 'DiagnosticSignInfo', text = ''})
|
|
|
|
vim.diagnostic.config({
|
|
virtual_text = false,
|
|
signs = true,
|
|
update_in_insert = true,
|
|
underline = true,
|
|
severity_sort = false,
|
|
float = {
|
|
border = 'rounded',
|
|
source = 'always',
|
|
header = '',
|
|
prefix = '',
|
|
},
|
|
})
|
|
|
|
vim.cmd([[
|
|
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
|
|
]])
|
|
|
|
|
|
require('nvim-lightbulb').setup({autocmd = {enabled = true}})
|