Merge branch 'main' into no-vimrc

This commit is contained in:
raf 2024-07-18 13:22:20 +00:00 committed by GitHub
commit 2a3c52488b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 67 additions and 73 deletions

View file

@ -44,6 +44,11 @@ This comes with a few breaking changes:
longer filtered and thus should be used instead. longer filtered and thus should be used instead.
- Add dap-go for better dap configurations - Add dap-go for better dap configurations
- Make noice.nvim customizable - Make noice.nvim customizable
- Switch from [rust-tools.nvim](https://github.com/simrat39/rust-tools.nvim)
to the more feature-packed [rustacean.nvim](https://github.com/mrcjkb/rustaceanvim.
This switch entails a whole bunch of new features and options, so you are
recommended to go through rustacean.nvim's README to take a closer look at
its features and usage.
[jacekpoz](https://github.com/jacekpoz): [jacekpoz](https://github.com/jacekpoz):

View file

@ -129,11 +129,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1720571246, "lastModified": 1721016451,
"narHash": "sha256-nkUXwunTck+hNMt2wZuYRN+jf2ySRjKTzI0fo5TDH78=", "narHash": "sha256-Cypl9ORr5UjtBsbjXMTJRepTe362yNVrPrntUvHiTaw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "16e401f01842c5bb2499e78c1fe227f939c0c474", "rev": "a14c5d651cee9ed70f9cd9e83f323f1e531002db",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1484,19 +1484,19 @@
"type": "github" "type": "github"
} }
}, },
"plugin-rust-tools": { "plugin-rustaceanvim": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1704259376, "lastModified": 1720595685,
"narHash": "sha256-kFane5ze7VDiOzF7jdmXkr50XQsNvdb+a9HQtybEVE0=", "narHash": "sha256-Mx8pB9ECjFpbfmZPuXfpwoE5pUZ363M53f27ht7MBmA=",
"owner": "simrat39", "owner": "mrcjkb",
"repo": "rust-tools.nvim", "repo": "rustaceanvim",
"rev": "676187908a1ce35ffcd727c654ed68d851299d3e", "rev": "047f9c9d8cd2861745eb9de6c1570ee0875aa795",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "simrat39", "owner": "mrcjkb",
"repo": "rust-tools.nvim", "repo": "rustaceanvim",
"type": "github" "type": "github"
} }
}, },
@ -1896,7 +1896,7 @@
"plugin-project-nvim": "plugin-project-nvim", "plugin-project-nvim": "plugin-project-nvim",
"plugin-registers": "plugin-registers", "plugin-registers": "plugin-registers",
"plugin-rose-pine": "plugin-rose-pine", "plugin-rose-pine": "plugin-rose-pine",
"plugin-rust-tools": "plugin-rust-tools", "plugin-rustaceanvim": "plugin-rustaceanvim",
"plugin-scrollbar-nvim": "plugin-scrollbar-nvim", "plugin-scrollbar-nvim": "plugin-scrollbar-nvim",
"plugin-smartcolumn": "plugin-smartcolumn", "plugin-smartcolumn": "plugin-smartcolumn",
"plugin-sqls-nvim": "plugin-sqls-nvim", "plugin-sqls-nvim": "plugin-sqls-nvim",

View file

@ -164,8 +164,8 @@
flake = false; flake = false;
}; };
plugin-rust-tools = { plugin-rustaceanvim = {
url = "github:simrat39/rust-tools.nvim"; url = "github:mrcjkb/rustaceanvim";
flake = false; flake = false;
}; };

View file

@ -125,30 +125,39 @@ in {
(mkIf (cfg.lsp.enable || cfg.dap.enable) { (mkIf (cfg.lsp.enable || cfg.dap.enable) {
vim = { vim = {
startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package]; startPlugins = ["rustaceanvim"];
lsp.lspconfig = { luaConfigRC.rustaceanvim = entryAnywhere ''
enable = true; vim.g.rustaceanvim = {
sources.rust-lsp = '' ${optionalString cfg.lsp.enable ''
local rt = require('rust-tools') -- LSP
rust_on_attach = function(client, bufnr) tools = {
hover_actions = {
replace_builtin_hover = false
},
},
server = {
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
},
on_attach = function(client, bufnr)
default_on_attach(client, bufnr) default_on_attach(client, bufnr)
local opts = { noremap=true, silent=true, buffer = bufnr } local opts = { noremap=true, silent=true, buffer = bufnr }
vim.keymap.set("n", "<leader>ris", rt.inlay_hints.set, opts) vim.keymap.set("n", "<leader>rr", ":RustLsp runnables<CR>", opts)
vim.keymap.set("n", "<leader>riu", rt.inlay_hints.unset, opts) vim.keymap.set("n", "<leader>rp", ":RustLsp parentModule<CR>", opts)
vim.keymap.set("n", "<leader>rr", rt.runnables.runnables, opts) vim.keymap.set("n", "<leader>rm", ":RustLsp expandMacro<CR>", opts)
vim.keymap.set("n", "<leader>rp", rt.parent_module.parent_module, opts) vim.keymap.set("n", "<leader>rc", ":RustLsp openCargo", opts)
vim.keymap.set("n", "<leader>rm", rt.expand_macro.expand_macro, opts) vim.keymap.set("n", "<leader>rg", ":RustLsp crateGraph x11", opts)
vim.keymap.set("n", "<leader>rc", rt.open_cargo_toml.open_cargo_toml, opts)
vim.keymap.set("n", "<leader>rg", function() rt.crate_graph.view_crate_graph("x11", nil) end, opts)
${optionalString cfg.dap.enable '' ${optionalString cfg.dap.enable ''
vim.keymap.set("n", "<leader>rd", ":RustDebuggables<cr>", opts) vim.keymap.set("n", "<leader>rd", ":RustLsp debuggables<cr>", opts)
vim.keymap.set( vim.keymap.set(
"n", "${config.vim.debugger.nvim-dap.mappings.continue}", "n", "${config.vim.debugger.nvim-dap.mappings.continue}",
function() function()
local dap = require("dap") local dap = require("dap")
if dap.status() == "" then if dap.status() == "" then
vim.cmd "RustDebuggables" vim.cmd "RustLsp debuggables"
else else
dap.continue() dap.continue()
end end
@ -157,41 +166,21 @@ in {
) )
''} ''}
end end
local rustopts = {
tools = {
autoSetHints = true,
hover_with_actions = false,
inlay_hints = {
only_current_line = false,
}
},
server = {
capabilities = capabilities,
on_attach = rust_on_attach,
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
},
settings = {
${cfg.lsp.opts}
}
}, },
''}
${optionalString cfg.dap.enable '' ${optionalString cfg.dap.enable ''
dap = { dap = {
adapter = { adapter = {
type = "executable", type = "executable",
command = "${cfg.dap.package}/bin/lldb-vscode", command = "${cfg.dap.package}/bin/lldb-vscode",
name = "rt_lldb", name = "rustacean_lldb",
}, },
}, },
''} ''}
} }
rt.setup(rustopts)
''; '';
}; };
};
}) })
]); ]);
} }