summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/user/lsp/rust.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/user/lsp/rust.lua')
-rw-r--r--.config/nvim/lua/user/lsp/rust.lua47
1 files changed, 29 insertions, 18 deletions
diff --git a/.config/nvim/lua/user/lsp/rust.lua b/.config/nvim/lua/user/lsp/rust.lua
index def29af..41cb03c 100644
--- a/.config/nvim/lua/user/lsp/rust.lua
+++ b/.config/nvim/lua/user/lsp/rust.lua
@@ -1,24 +1,35 @@
-lsp = require 'lspconfig'
+local lsp = require 'lspconfig'
+local rust = require 'rust-tools'
-vim.cmd [[
- autocmd FileType rust highlight link rustLifetime SpecialComment
-]]
+-- vim.cmd [[
+-- autocmd FileType rust highlight link rustLifetime SpecialComment
+-- ]]
-vim.cmd [[
- autocmd FileType rust setlocal inccommand=nosplit
-]]
+-- vim.cmd [[
+-- autocmd FileType rust setlocal inccommand=nosplit
+-- ]]
-lsp.rust_analyzer.setup{
- cmd = {"rust-analyzer"},
- filetypes = {"rust", "rs"},
- root_dir = lsp.util.root_pattern("Cargo.toml"),
- -- fucking magic
- capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()),
- settings = {
- ["rust-analyzer"] = {
- disgnostics = { enable = true },
- inlayHints = { typeHints = true },
- },
+-- lsp.rust_analyzer.setup{
+-- cmd = {"rust-analyzer"},
+-- filetypes = {"rust", "rs"},
+-- root_dir = lsp.util.root_pattern("Cargo.toml"),
+-- -- fucking magic
+-- capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()),
+-- settings = {
+-- ["rust-analyzer"] = {
+-- disgnostics = { enable = true },
+-- inlayHints = { typeHints = true },
+-- },
+-- },
+-- }
+
+rust.setup{
+ server = {
+ on_attach = function(_, bufnr)
+ vim.keymap.set("n", "<leader> ", rust.hover_actions.hover_actions, { buffer = bufnr })
+ vim.keymap.set("n", "<leader>a", rust.code_action_group.code_action_group, { buffer = bufnr })
+ end,
},
}
+