mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 08:41:43 +05:30
fix(neovim): Rust test-coverage plugin & coding qol improvements
- Rust: `nvim-coverage` for generating code-coverage report - Rust: Keymaps & nvim-job for test-coverage report display - Coding-QOL: Remove distracting & noisy diagnostic virtual-line - Coding-QOL: Keymaps to disable diagnostic virtual text - Coding-QOL: Disable diagnostic underlines - Fix: Disable telescope `hightlight` to fix frequent crash - Coding-QOL: Telescope Keymaps to move between loops - Coding-QOL: Disable auto fn doc hover through `blink`; `LSPSaga` does it better - Coding-QOL: Adding back `quick-scope` with proper config - Keymap: Use `ctrl-p` to search files; same as vscode
This commit is contained in:
@@ -8,3 +8,23 @@ if pcall(require, "rustaceanvim") then
|
||||
vim.keymap.set("n", "<leader>rM", "<cmd>RustLsp view mir<cr>", { desc = "View Mid-Level IR", buffer = bufnr })
|
||||
vim.keymap.set("n", "<leader>rH", "<cmd>RustLsp view hir<cr>", { desc = "View High-Level IR", buffer = bufnr })
|
||||
end
|
||||
|
||||
local function run_tests_with_coverage()
|
||||
-- Run tests through neotest
|
||||
require("neotest").run.run(vim.fn.expand("%"))
|
||||
|
||||
-- Generate coverage after tests complete
|
||||
vim.fn.jobstart("cargo llvm-cov --lcov --output-path coverage.lcov", {
|
||||
on_exit = function(_, code)
|
||||
if code == 0 then
|
||||
-- Load coverage data
|
||||
require("coverage").load(true)
|
||||
print("Coverage updated")
|
||||
else
|
||||
print("Coverage generation failed")
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>tc", run_tests_with_coverage, { desc = "Test: Run tests with coverage" })
|
||||
|
||||
Reference in New Issue
Block a user