From: Huck Boles Date: Sat, 17 Jun 2023 02:39:43 +0000 (-0500) Subject: added: rust tools X-Git-Url: https://git.huck.website/?a=commitdiff_plain;h=24b78353f036644382cfc1e45550ceb4082ad207;p=nvim.git added: rust tools --- diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 763d562..467ea00 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -78,44 +78,44 @@ return { config = function() -- servers to setup local lsp = require("lspconfig") - lsp.rust_analyzer.setup({ - settings = { - ['rust-analyzer'] = { - completion = { - privateEditable = true, - completionItem = { - preselectSupport = true, - snippetSupport = true, - } - }, - hover = { - actions = { - enable = true, - references = true, - } - }, - imports = { - granularity = { - enforce = true, - }, - group = true, - prefix = "self", - }, - inlayHints = { - closureCaptureHints = true, - closureReturnTypeHints = true, - lifetimeElisionHints = true, - discriminantHints = true, - expressionAdjustmentHints = { enable = true, mode = "postfix" }, - closingBraceHints = { enable = true, minLines = 1 }, - }, - highlightRelated = { enable = true }, - magicCompletions = { enable = true }, - procMacro = { - enable = true - } } - } - }) + -- lsp.rust_analyzer.setup({ + -- settings = { + -- ['rust-analyzer'] = { + -- completion = { + -- privateEditable = true, + -- completionItem = { + -- preselectSupport = true, + -- snippetSupport = true, + -- } + -- }, + -- hover = { + -- actions = { + -- enable = true, + -- references = true, + -- } + -- }, + -- imports = { + -- granularity = { + -- enforce = true, + -- }, + -- group = true, + -- prefix = "self", + -- }, + -- inlayHints = { + -- closureCaptureHints = true, + -- closureReturnTypeHints = true, + -- lifetimeElisionHints = true, + -- discriminantHints = true, + -- expressionAdjustmentHints = { enable = true, mode = "postfix" }, + -- closingBraceHints = { enable = true, minLines = 1 }, + -- }, + -- highlightRelated = { enable = true }, + -- magicCompletions = { enable = true }, + -- procMacro = { + -- enable = true + -- } } + -- } + -- }) lsp.awk_ls.setup({}) lsp.bashls.setup({}) lsp.clangd.setup({}) @@ -170,4 +170,46 @@ return { }) end, }, + + { + 'simrat39/rust-tools.nvim', + ft = "rust", + config = function() + local rust = require("rust-tools") + + rust.setup( + { + tools = { + inlay_hints = { + only_current_line = true, + parameter_hints_prefix = "", + other_hints_prefix = "< " + }, + hover_actions = { + border = { + { "┏", "FloatBorder" }, + { "━", "FloatBorder" }, + { "┓", "FloatBorder" }, + { "┃", "FloatBorder" }, + { "┛", "FloatBorder" }, + { "━", "FloatBorder" }, + { "┗", "FloatBorder" }, + { "┃", "FloatBorder" }, + }, + auto_focus = true + } + }, + server = { + on_attach = function(_, bufnr) + vim.keymap.set('n', 'k', rust.hover_actions.hover_actions, { buffer = bufnr }) + vim.keymap.set('n', 'a', rust.code_action_group.code_action_group, { buffer = bufnr }) + vim.keymap.set('n', 'm', rust.expand_macro.expand_macro, { buffer = bufnr }) + vim.keymap.set('n', 'c', rust.open_cargo_toml.open_cargo_toml, { buffer = bufnr }) + vim.keymap.set('n', 'P', rust.parent_module.parent_module, { buffer = bufnr }) + end + } + } + ) + end + }, }