mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
Switch to rustaceanvim (#335)
* flake: use rustaceanvim instead of rust-tools * rust: switch to rustaceanvim * docs: update release notes * flake: update nixpkgs * docs: wording --------- Co-authored-by: raf <raf@notashelf.dev>
This commit is contained in:
parent
0f17147d52
commit
9c93e9a9c0
4 changed files with 67 additions and 73 deletions
|
@ -34,6 +34,11 @@ Release notes for release 0.7
|
||||||
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):
|
||||||
|
|
||||||
|
|
24
flake.lock
24
flake.lock
|
@ -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",
|
||||||
|
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -125,72 +125,61 @@ 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 = {
|
||||||
default_on_attach(client, bufnr)
|
hover_actions = {
|
||||||
local opts = { noremap=true, silent=true, buffer = bufnr }
|
replace_builtin_hover = false
|
||||||
vim.keymap.set("n", "<leader>ris", rt.inlay_hints.set, opts)
|
|
||||||
vim.keymap.set("n", "<leader>riu", rt.inlay_hints.unset, opts)
|
|
||||||
vim.keymap.set("n", "<leader>rr", rt.runnables.runnables, opts)
|
|
||||||
vim.keymap.set("n", "<leader>rp", rt.parent_module.parent_module, opts)
|
|
||||||
vim.keymap.set("n", "<leader>rm", rt.expand_macro.expand_macro, 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 ''
|
|
||||||
vim.keymap.set("n", "<leader>rd", ":RustDebuggables<cr>", opts)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n", "${config.vim.debugger.nvim-dap.mappings.continue}",
|
|
||||||
function()
|
|
||||||
local dap = require("dap")
|
|
||||||
if dap.status() == "" then
|
|
||||||
vim.cmd "RustDebuggables"
|
|
||||||
else
|
|
||||||
dap.continue()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
opts
|
|
||||||
)
|
|
||||||
''}
|
|
||||||
end
|
|
||||||
local rustopts = {
|
|
||||||
tools = {
|
|
||||||
autoSetHints = true,
|
|
||||||
hover_with_actions = false,
|
|
||||||
inlay_hints = {
|
|
||||||
only_current_line = false,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
server = {
|
},
|
||||||
capabilities = capabilities,
|
server = {
|
||||||
on_attach = rust_on_attach,
|
cmd = ${
|
||||||
cmd = ${
|
|
||||||
if isList cfg.lsp.package
|
if isList cfg.lsp.package
|
||||||
then expToLua cfg.lsp.package
|
then expToLua cfg.lsp.package
|
||||||
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
||||||
},
|
},
|
||||||
settings = {
|
on_attach = function(client, bufnr)
|
||||||
${cfg.lsp.opts}
|
default_on_attach(client, bufnr)
|
||||||
}
|
local opts = { noremap=true, silent=true, buffer = bufnr }
|
||||||
},
|
vim.keymap.set("n", "<leader>rr", ":RustLsp runnables<CR>", opts)
|
||||||
|
vim.keymap.set("n", "<leader>rp", ":RustLsp parentModule<CR>", opts)
|
||||||
${optionalString cfg.dap.enable ''
|
vim.keymap.set("n", "<leader>rm", ":RustLsp expandMacro<CR>", opts)
|
||||||
dap = {
|
vim.keymap.set("n", "<leader>rc", ":RustLsp openCargo", opts)
|
||||||
adapter = {
|
vim.keymap.set("n", "<leader>rg", ":RustLsp crateGraph x11", opts)
|
||||||
type = "executable",
|
${optionalString cfg.dap.enable ''
|
||||||
command = "${cfg.dap.package}/bin/lldb-vscode",
|
vim.keymap.set("n", "<leader>rd", ":RustLsp debuggables<cr>", opts)
|
||||||
name = "rt_lldb",
|
vim.keymap.set(
|
||||||
},
|
"n", "${config.vim.debugger.nvim-dap.mappings.continue}",
|
||||||
},
|
function()
|
||||||
|
local dap = require("dap")
|
||||||
|
if dap.status() == "" then
|
||||||
|
vim.cmd "RustLsp debuggables"
|
||||||
|
else
|
||||||
|
dap.continue()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
opts
|
||||||
|
)
|
||||||
''}
|
''}
|
||||||
}
|
end
|
||||||
rt.setup(rustopts)
|
},
|
||||||
'';
|
''}
|
||||||
};
|
|
||||||
|
${optionalString cfg.dap.enable ''
|
||||||
|
dap = {
|
||||||
|
adapter = {
|
||||||
|
type = "executable",
|
||||||
|
command = "${cfg.dap.package}/bin/lldb-vscode",
|
||||||
|
name = "rustacean_lldb",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
''}
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue