From d4ffb9a874bfd4c6904036df1f7ccd5267103fd7 Mon Sep 17 00:00:00 2001 From: kalmenn Date: Mon, 16 Dec 2024 15:37:31 +0100 Subject: [PATCH] feat(rust): Migrate to rustacean.nvim --- lazy-lock.json | 30 +++++++++++++++--------------- lua/plugins/languages/rust.lua | 27 +++++++++++++-------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index b854bba..1304050 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,34 +2,34 @@ "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "crates.nvim": { "branch": "main", "commit": "1c924d5a9ea3496c4e1a02d0d51388ba809f8468" }, - "fd": { "branch": "master", "commit": "7a908a474cbcb3f37a4e6407a30d81bf85106217" }, + "fd": { "branch": "master", "commit": "331daf10b8b929aef39158e91892afe28d6fb816" }, "feline.nvim": { "branch": "main", "commit": "9f1313f61a75ec5ebe805fedd46bdc130c420963" }, - "gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" }, + "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, "haskell-tools.nvim": { "branch": "master", "commit": "cbfee33efb3d7252453e454d61c6b939539ea35f" }, "idris2-nvim": { "branch": "main", "commit": "8bff02984a33264437e70fd9fff4359679d910da" }, - "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" }, + "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, "mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "neo-tree-diagnostics.nvim": { "branch": "main", "commit": "e00434c3cf8637bcaf70f65c2b9d82b0cc9bd7dc" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, - "none-ls.nvim": { "branch": "main", "commit": "1f2bf17eddfdd45aed254b6922c6c68b933dba9e" }, - "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, - "nvim": { "branch": "main", "commit": "637d99e638bc6f1efedac582f6ccab08badac0c6" }, - "nvim-cmp": { "branch": "main", "commit": "40a03dc225383c4f6256596c2cdf27e03b8119b5" }, + "none-ls.nvim": { "branch": "main", "commit": "c279e541f73a2deea9deb5231b9c037678dd6353" }, + "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, + "nvim": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" }, + "nvim-cmp": { "branch": "main", "commit": "3403e2e9391ed0a28c3afddd8612701b647c8e26" }, "nvim-jdtls": { "branch": "master", "commit": "ece818f909c6414cbad4e1fb240d87e003e10fda" }, - "nvim-lspconfig": { "branch": "master", "commit": "291a8f1a319dc712db85bcc174b0cf406f0a5b69" }, - "nvim-metals": { "branch": "main", "commit": "f861db9fda55939797ac1b05238c49b0dcdc3bdb" }, - "nvim-treesitter": { "branch": "master", "commit": "a3a732107f8b529f97bf4921b3e1af5dcc756bb6" }, - "nvim-web-devicons": { "branch": "master", "commit": "e87554285f581047b1bf236794b0eb812b444b87" }, - "overseer.nvim": { "branch": "master", "commit": "e734140137cdd25b4c31c0fb9bf22faa9c115dcc" }, + "nvim-lspconfig": { "branch": "master", "commit": "ae8a01bb40848490548e5d07b97ed972ed43c2f9" }, + "nvim-metals": { "branch": "main", "commit": "6d4b3c3a6159dc3caad6fb10ab0473315d8397f5" }, + "nvim-treesitter": { "branch": "master", "commit": "1d0a8b91d02511a7f4d7aa74b2db0e19d6e780be" }, + "nvim-web-devicons": { "branch": "master", "commit": "0eb18da56e2ba6ba24de7130a12bcc4e31ad11cb" }, + "overseer.nvim": { "branch": "master", "commit": "10ee48ff96c8d1049efb278ea4c8cf9f3b0e4326" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "ripgrep": { "branch": "master", "commit": "79cbe89deb1151e703f4d91b19af9cdcc128b765" }, - "rustaceanvim": { "branch": "master", "commit": "a244210b28f9055c2b4cfa85c92c8a71c13671c9" }, + "rustaceanvim": { "branch": "master", "commit": "25aab238aad3e58f864274449456bdc339981750" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, - "vim-fugitive": { "branch": "master", "commit": "320b18fba2a4f2fe3c8225c778c687e0d2620384" } + "vim-fugitive": { "branch": "master", "commit": "fcb4db52e7f65b95705aa58f0f2df1312c1f2df2" } } diff --git a/lua/plugins/languages/rust.lua b/lua/plugins/languages/rust.lua index ccf0dbf..e2278f0 100644 --- a/lua/plugins/languages/rust.lua +++ b/lua/plugins/languages/rust.lua @@ -38,27 +38,26 @@ return { event = "BufEnter Cargo.toml", }, { - "simrat39/rust-tools.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "hrsh7th/cmp-nvim-lsp", - }, - lazy = true, - config = function() - local capabilities = require("cmp_nvim_lsp").default_capabilities() - - require("rust-tools").setup({ + 'mrcjkb/rustaceanvim', + version = '^5', + lazy = false, + init = function() + vim.g.rustaceanvim = { server = { - capabilities = capabilities, - settings = { - ["rust-analyzer"] = { + on_attach = function(client, bufnr) + opts = { silent = true, buffer = bufnr } + vim.keymap.set("n", "a", function() vim.cmd.RustLsp('codeAction') end, opts) + vim.keymap.set("n", "K", function() vim.cmd.RustLsp({'hover', 'actions'}) end, opts) + end, + default_settings = { + ['rust-analyzer'] = { check = { command = "clippy", }, }, }, }, - }) + } end, }, }