From 13711244544ac19fa4c2638043194523dab19d5c Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Mon, 1 Apr 2024 02:32:27 -0500 Subject: [PATCH] chg: Switched to rustaceanvim for Rust --- laptop/config/plugins.lua | 6 +++++- laptop/plugin/lsp_config.lua | 11 ---------- laptop/plugin/rust.lua | 41 +++++++++++++++++++++++++----------- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/laptop/config/plugins.lua b/laptop/config/plugins.lua index 2749ec1..8449238 100644 --- a/laptop/config/plugins.lua +++ b/laptop/config/plugins.lua @@ -52,7 +52,11 @@ require("lazy").setup( -- vim-moonfly theme { "bluz71/vim-moonfly-colors", as = "moonfly" }, -- Rust tools - "simrat39/rust-tools.nvim", + { + "mrcjkb/rustaceanvim", + version = "^4", + ft = { "rust" }, + }, -- Automatically add bracket pairs "windwp/nvim-autopairs", -- Syntax highlighting for Fish scripts diff --git a/laptop/plugin/lsp_config.lua b/laptop/plugin/lsp_config.lua index f49af5b..de6e45e 100644 --- a/laptop/plugin/lsp_config.lua +++ b/laptop/plugin/lsp_config.lua @@ -8,14 +8,3 @@ lspconfig.lua_ls.setup({ }, } }) - -lspconfig.rust_analyzer.setup { - -- Server-specific settings. See `:help lspconfig-setup` - settings = { - ['rust-analyzer'] = { - check = { - command = "clippy", - } - }, - }, -} diff --git a/laptop/plugin/rust.lua b/laptop/plugin/rust.lua index b092415..146a6cd 100644 --- a/laptop/plugin/rust.lua +++ b/laptop/plugin/rust.lua @@ -1,12 +1,29 @@ -require("rust-tools").setup({ - server = { - settings = { - ["rust-analyzer"] = { - check = { - command = "clippy" - }, - }, - }, - }, -}) - +vim.g.rustaceanvim = { + -- Plugin configuration + tools = { + }, + -- LSP configuration + server = { + on_attach = function(_, bufnr) + vim.keymap.set( + "n", + "a", + function() + vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping + end, + { silent = true, buffer = bufnr, noremap = true } + ) + end, + default_settings = { + -- rust-analyzer language server configuration + ["rust-analyzer"] = { + check = { + command = "clippy" + } + }, + }, + }, + -- DAP configuration + dap = { + }, +}