feat(nvim/rustacean): runnables config
This commit is contained in:
parent
fa4f77984e
commit
8f2d37e785
@ -82,6 +82,7 @@ in
|
||||
) # https://github.com/mrcjkb/rustaceanvim/discussions/46#discussioncomment-7620822
|
||||
plenary-nvim
|
||||
crates-nvim
|
||||
neotest
|
||||
nvim-lspconfig
|
||||
telescope-nvim
|
||||
telescope-undo-nvim
|
||||
|
8
init.lua
8
init.lua
@ -236,7 +236,13 @@ lspconfig.nil_ls.setup {
|
||||
autoEvalInputs = true,
|
||||
},
|
||||
}
|
||||
|
||||
require('neotest').setup {
|
||||
-- ...,
|
||||
adapters = {
|
||||
-- ...,
|
||||
require('rustaceanvim.neotest')
|
||||
},
|
||||
}
|
||||
require("lsp-inlayhints").setup()
|
||||
require("completion")
|
||||
require("rust")
|
||||
|
43
rust.lua
43
rust.lua
@ -6,7 +6,11 @@ vim.g.rustaceanvim = {
|
||||
tools = { -- rust-tools options
|
||||
-- how to execute terminal commands
|
||||
-- options right now: termopen / quickfix / toggleterm / vimux
|
||||
executor = require("rust-tools.executors").termopen,
|
||||
executor = require('rustaceanvim.executors').termopen,
|
||||
|
||||
test_executor = require('rustaceanvim.executors').neotest;
|
||||
|
||||
crate_test_executor = require('rustaceanvim.executors').background;
|
||||
|
||||
-- callback to execute once rust-analyzer is done initializing the workspace
|
||||
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
|
||||
@ -52,8 +56,7 @@ vim.g.rustaceanvim = {
|
||||
highlight = "Comment"
|
||||
},
|
||||
|
||||
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
|
||||
hover_actions = {
|
||||
float_win_config = {
|
||||
|
||||
-- the border that is used for the hover window
|
||||
-- see vim.api.nvim_open_win()
|
||||
@ -72,7 +75,7 @@ vim.g.rustaceanvim = {
|
||||
|
||||
-- whether the hover action window gets automatically focused
|
||||
-- default: false
|
||||
auto_focus = false
|
||||
auto_focus = false,
|
||||
},
|
||||
|
||||
-- settings for showing the crate graph based on graphviz and the dot
|
||||
@ -133,20 +136,36 @@ vim.g.rustaceanvim = {
|
||||
function() vim.cmd.RustLsp('openCargo') end,
|
||||
keymap_opts)
|
||||
vim.keymap.set('n', '<leader>cr', function()
|
||||
vim.cmd.RustLsp {'runnables', }
|
||||
end, keymap_opts)
|
||||
|
||||
vim.keymap.set('n', '<leader>cR', function()
|
||||
vim.cmd.RustLsp {'runnables', 'last' --[[ optional ]] }
|
||||
end, keymap_opts)
|
||||
vim.keymap.set('n', '<leader>cd', function()
|
||||
vim.cmd.RustLsp {'debuggables', }
|
||||
end, keymap_opts)
|
||||
|
||||
vim.keymap.set('n', '<leader>cD', function()
|
||||
vim.cmd.RustLsp {'debuggables', 'last' --[[ optional ]] }
|
||||
end, keymap_opts)
|
||||
|
||||
vim.keymap.set('n', '<leader>ct', function()
|
||||
vim.cmd.RustLsp {'testables', }
|
||||
end, keymap_opts)
|
||||
|
||||
vim.keymap.set('n', '<leader>cT', function()
|
||||
vim.cmd.RustLsp {'testables', 'last' }
|
||||
end, keymap_opts)
|
||||
|
||||
vim.keymap.set('n', '<leader>cm', function()
|
||||
vim.cmd.RustLsp {'expandMacro'}
|
||||
end, keymap_opts)
|
||||
|
||||
vim.keymap.set('n', '<leader>cE', function()
|
||||
vim.cmd.RustLsp {'explainError'}
|
||||
end, keymap_opts)
|
||||
-- vim.keymap.set("n", "g0", vim.lsp.buf.document_symbol, keymap_opts)
|
||||
local diag_float_grp = vim.api.nvim_create_augroup(
|
||||
"DiagnosticFloat", {clear = true})
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
callback = function()
|
||||
vim.diagnostic.open_float(nil, {focusable = false})
|
||||
end,
|
||||
group = diag_float_grp
|
||||
})
|
||||
|
||||
-- Goto previous/next diagnostic warning/error
|
||||
vim.keymap.set("n", "g[", vim.diagnostic.goto_prev, keymap_opts)
|
||||
|
Loading…
x
Reference in New Issue
Block a user