lsp: added rust-tools

This commit is contained in:
kalmenn 2023-12-27 00:52:20 +01:00
parent bc4037ef6f
commit 1ee103951a
Signed by: kalmenn
GPG key ID: F500055C44BC3834
3 changed files with 51 additions and 31 deletions

View file

@ -28,31 +28,55 @@ vim.api.nvim_create_autocmd('LspAttach', {
})
return {
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require("lspconfig")
{
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require("lspconfig")
lspconfig.pyright.setup({})
lspconfig.pyright.setup({})
lspconfig.rust_analyzer.setup({})
lspconfig.rust_analyzer.setup({})
lspconfig.lua_ls.setup({
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
lspconfig.lua_ls.setup({
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
})
end
},
{
"simrat39/rust-tools.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
{
"Saecki/crates.nvim",
tag = 'stable',
},
})
end
},
opts = {
server = {
on_attach = function(_, bufnr)
local rt = require("rust-tools");
-- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
end,
},
},
event = { "LspAttach *.rs" },
}
}