diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 6fc8857..e7a3056 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -74,6 +74,7 @@ vim.diagnostic.config({ }) -- rust tools +local rt = require("rust-tools") -- Configure LSP through rust-tools.nvim plugin. -- rust-tools will configure and enable certain LSP features for us. @@ -104,6 +105,10 @@ local opts = { checkOnSave = { command = "clippy", }, + cargo = { + -- to enable include! macro being read + loadOutDirsFromCheck = true + }, }, }, }, @@ -114,16 +119,14 @@ opts.server.on_attach = function(client, bufnr) local opts = { buffer = bufnr, remap = false } vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) - vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) - vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "K", function() rt.hover_actions.hover_actions() end, opts) + vim.keymap.set("n", "gl", function() vim.diagnostic.open_float() end, opts) - vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) - vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set("n", "la", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "lf", function() vim.lsp.buf.format() end, opts) vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, opts) - vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) - vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) end -require("rust-tools").setup(opts) +rt.setup(opts)