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
|
) # https://github.com/mrcjkb/rustaceanvim/discussions/46#discussioncomment-7620822
|
||||||
plenary-nvim
|
plenary-nvim
|
||||||
crates-nvim
|
crates-nvim
|
||||||
|
neotest
|
||||||
nvim-lspconfig
|
nvim-lspconfig
|
||||||
telescope-nvim
|
telescope-nvim
|
||||||
telescope-undo-nvim
|
telescope-undo-nvim
|
||||||
|
8
init.lua
8
init.lua
@ -236,7 +236,13 @@ lspconfig.nil_ls.setup {
|
|||||||
autoEvalInputs = true,
|
autoEvalInputs = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
require('neotest').setup {
|
||||||
|
-- ...,
|
||||||
|
adapters = {
|
||||||
|
-- ...,
|
||||||
|
require('rustaceanvim.neotest')
|
||||||
|
},
|
||||||
|
}
|
||||||
require("lsp-inlayhints").setup()
|
require("lsp-inlayhints").setup()
|
||||||
require("completion")
|
require("completion")
|
||||||
require("rust")
|
require("rust")
|
||||||
|
43
rust.lua
43
rust.lua
@ -6,7 +6,11 @@ vim.g.rustaceanvim = {
|
|||||||
tools = { -- rust-tools options
|
tools = { -- rust-tools options
|
||||||
-- how to execute terminal commands
|
-- how to execute terminal commands
|
||||||
-- options right now: termopen / quickfix / toggleterm / vimux
|
-- 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
|
-- 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"
|
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
|
||||||
@ -52,8 +56,7 @@ vim.g.rustaceanvim = {
|
|||||||
highlight = "Comment"
|
highlight = "Comment"
|
||||||
},
|
},
|
||||||
|
|
||||||
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
|
float_win_config = {
|
||||||
hover_actions = {
|
|
||||||
|
|
||||||
-- the border that is used for the hover window
|
-- the border that is used for the hover window
|
||||||
-- see vim.api.nvim_open_win()
|
-- see vim.api.nvim_open_win()
|
||||||
@ -72,7 +75,7 @@ vim.g.rustaceanvim = {
|
|||||||
|
|
||||||
-- whether the hover action window gets automatically focused
|
-- whether the hover action window gets automatically focused
|
||||||
-- default: false
|
-- default: false
|
||||||
auto_focus = false
|
auto_focus = false,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- settings for showing the crate graph based on graphviz and the dot
|
-- 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,
|
function() vim.cmd.RustLsp('openCargo') end,
|
||||||
keymap_opts)
|
keymap_opts)
|
||||||
vim.keymap.set('n', '<leader>cr', function()
|
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 ]] }
|
vim.cmd.RustLsp {'runnables', 'last' --[[ optional ]] }
|
||||||
end, keymap_opts)
|
end, keymap_opts)
|
||||||
vim.keymap.set('n', '<leader>cd', function()
|
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 ]] }
|
vim.cmd.RustLsp {'debuggables', 'last' --[[ optional ]] }
|
||||||
end, keymap_opts)
|
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)
|
-- 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
|
-- Goto previous/next diagnostic warning/error
|
||||||
vim.keymap.set("n", "g[", vim.diagnostic.goto_prev, keymap_opts)
|
vim.keymap.set("n", "g[", vim.diagnostic.goto_prev, keymap_opts)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user