Add testing back, error fixed (hopefully)
This commit is contained in:
parent
3bec60aaa6
commit
f37ac7a88f
@ -5,9 +5,11 @@ return {
|
|||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||||
"mfussenegger/nvim-jdtls",
|
-- "mfussenegger/nvim-jdtls",
|
||||||
|
"nvim-java/nvim-java"
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
|
require('java').setup()
|
||||||
-- import lspconfig plugin
|
-- import lspconfig plugin
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
@ -130,29 +132,50 @@ return {
|
|||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- lspconfig.ts_ls.setup({
|
local java_on_attach = function(client, bufnr)
|
||||||
-- capabilities = capabilities,
|
opts.buffer = bufnr
|
||||||
-- on_attach = on_attach,
|
|
||||||
-- })
|
|
||||||
|
|
||||||
-- local mason_registry = require('mason-registry')
|
-- Keybinds for testing, refactoring, java specific
|
||||||
-- local vue_language_server_path = mason_registry.get_package('vue-language-server'):get_install_path() .. '/node_modules/@vue/language-server'
|
opts.desc = "Java profiling"
|
||||||
--
|
keymap.set("n", "<leader>jp", ":JavaProfile<CR>", opts)
|
||||||
-- lspconfig.volar.setup({
|
|
||||||
-- capabilities = capabilities,
|
opts.desc = "Java Refactor: Extract Variable (create variable from cursor)"
|
||||||
-- on_attach = on_attach,
|
keymap.set("n", "<leader>jev", ":JavaExtractVariable<CR>", opts)
|
||||||
-- -- cmd = { "vue-language-server", "--stdio" },
|
|
||||||
-- filetypes = { "vue" },
|
opts.desc = "Java Refactor: Extract Variable all occurrences (create variable from cursor)"
|
||||||
-- -- settings = {
|
keymap.set("n", "<leader>jea", ":JavaExtractVariableAllOccurrence<CR>", opts)
|
||||||
-- -- typescript = {
|
|
||||||
-- -- tsdk = '/usr/lib/node_modules/typescript/lib'
|
opts.desc = "Java Refactor: Extract Const (create const from cursor)"
|
||||||
-- -- }
|
keymap.set("n", "<leader>jec", ":JavaExtractConst<CR>", opts)
|
||||||
-- -- }
|
|
||||||
-- })
|
opts.desc = "Java Refactor: Extract Method (create method from cursor)"
|
||||||
|
keymap.set("n", "<leader>jev", ":JavaExtractMethod<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Java Refactor: Extract Field (create field from cursor)"
|
||||||
|
keymap.set("n", "<leader>jev", ":JavaExtractField<CR>", opts)
|
||||||
|
|
||||||
|
-- Java testing, Debugging
|
||||||
|
opts.desc = "Java Testing: Run test class in buffer"
|
||||||
|
keymap.set("n", "<leader>jtc", ":JavaTestRunCurrentClass<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Java Testing: Debug test class in buffer"
|
||||||
|
keymap.set("n", "<leader>jdc", ":JavaTestDebugCurrentClass<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Java Testing: Run current method in buffer"
|
||||||
|
keymap.set("n", "<leader>jtm", ":JavaTestRunCurrentMethod<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Java Testing: Debug current method in buffer"
|
||||||
|
keymap.set("n", "<leader>jdm", ":JavaTestDebugCurrentMethod<CR>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Java Testing: View last report"
|
||||||
|
keymap.set("n", "<leader>jtv", ":JavaTestViewLastReport<CR>", opts)
|
||||||
|
|
||||||
|
on_attach(client, bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
lspconfig.jdtls.setup({
|
lspconfig.jdtls.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = java_on_attach,
|
||||||
})
|
})
|
||||||
|
|
||||||
lspconfig.texlab.setup{
|
lspconfig.texlab.setup{
|
||||||
|
70
nvim/lua/plugins/neotest.lua
Executable file
70
nvim/lua/plugins/neotest.lua
Executable file
@ -0,0 +1,70 @@
|
|||||||
|
-- plugins/neotest_config.lua
|
||||||
|
return {
|
||||||
|
-- Load neotest
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
dependencies = {
|
||||||
|
-- For JavaScript, TypeScript (Vite)
|
||||||
|
"marilari88/neotest-vitest",
|
||||||
|
-- For Python
|
||||||
|
"nvim-neotest/neotest-python",
|
||||||
|
-- For C, C++, Rust
|
||||||
|
"orjangj/neotest-ctest",
|
||||||
|
"rouge8/neotest-rust",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local neotest = require("neotest")
|
||||||
|
local keymap = vim.keymap.set
|
||||||
|
|
||||||
|
-- General setup for neotest
|
||||||
|
neotest.setup({
|
||||||
|
adapters = {
|
||||||
|
-- Vite Adapter for JavaScript/TypeScript
|
||||||
|
require("neotest-vitest"),
|
||||||
|
-- Python Adapter
|
||||||
|
require("neotest-python"),
|
||||||
|
-- C/C++ Adapter
|
||||||
|
require("neotest-ctest"),
|
||||||
|
-- Rust Adapter
|
||||||
|
require("neotest-rust"),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Keybinding Setup
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
-- Run nearest test
|
||||||
|
opts.desc = "Run nearest test"
|
||||||
|
keymap("n", "<leader><leader>tr", '<cmd>lua require("neotest").run.run()<cr>', opts)
|
||||||
|
|
||||||
|
-- Run all tests in the current file
|
||||||
|
opts.desc = "Run all tests in current file"
|
||||||
|
keymap("n", "<leader><leader>tf", '<cmd>lua require("neotest").run.run(vim.fn.expand("%"))', opts)
|
||||||
|
|
||||||
|
-- Run all tests in the entire project
|
||||||
|
opts.desc = "Run all tests in project"
|
||||||
|
keymap("n", "<leader><leader>ta", "<cmd>Neotest run<cr>", opts)
|
||||||
|
|
||||||
|
-- Stop running tests
|
||||||
|
opts.desc = "Stop tests"
|
||||||
|
keymap("n", "<leader><leader>ts", "<cmd>Neotest stop<cr>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Jump to next test"
|
||||||
|
keymap("n", "<leader><leader>tn", "<cmd>Neotest jump next<cr>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Jump to previous test"
|
||||||
|
keymap("n", "<leader><leader>tp", "<cmd>Neotest jump prev<cr>", opts)
|
||||||
|
|
||||||
|
-- Show test summary
|
||||||
|
opts.desc = "Show neotest test summary"
|
||||||
|
keymap("n", "<leader><leader>tv", "<cmd>Neotest summary<cr>", opts)
|
||||||
|
|
||||||
|
-- Toggle the Neotest panel
|
||||||
|
opts.desc = "Show neotest output"
|
||||||
|
keymap("n", "<leader><leader>to", "<cmd>Neotest output<cr>", opts)
|
||||||
|
|
||||||
|
opts.desc = "Show neotest output as panel"
|
||||||
|
keymap("n", "<leader><leader>tn", "<cmd>Neotest output-panel<cr>", opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user