added neotest
This commit is contained in:
parent
ba66fa246e
commit
7a9b928d78
21
init.lua
21
init.lua
|
|
@ -34,6 +34,8 @@ vim.opt.inccommand = 'split'
|
|||
vim.opt.cursorline = true
|
||||
vim.opt.scrolloff = 10
|
||||
vim.opt.confirm = true
|
||||
vim.o.swapfile = false
|
||||
vim.o.backup = false
|
||||
|
||||
-- Convert Tab to spaces
|
||||
vim.cmd([[filetype plugin indent on]])
|
||||
|
|
@ -75,6 +77,8 @@ end ---@diagnostic disable-next-line: undefined-field
|
|||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require('lazy').setup({
|
||||
-- ... existing plugins ...
|
||||
require('plugins/neotest'), -- Add this line
|
||||
require('plugins/web-devicons'),
|
||||
require('plugins/neo-tree'),
|
||||
require('plugins/conform'),
|
||||
|
|
@ -156,4 +160,21 @@ require('lazy').setup({
|
|||
lang = 'typescript',
|
||||
},
|
||||
},
|
||||
{
|
||||
'folke/snacks.nvim',
|
||||
---@type snacks.Config
|
||||
opts = {
|
||||
input = {},
|
||||
styles = {
|
||||
input = {
|
||||
relative = 'cursor',
|
||||
row = -3,
|
||||
col = 0,
|
||||
position = 'float',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local a = ''
|
||||
|
|
|
|||
|
|
@ -1,31 +1,37 @@
|
|||
{
|
||||
"blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" },
|
||||
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
|
||||
"blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" },
|
||||
"ccc.nvim": { "branch": "main", "commit": "9d1a256e006decc574789dfc7d628ca11644d4c2" },
|
||||
"conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" },
|
||||
"cspell.nvim": { "branch": "main", "commit": "fb104ec1e06e984baefcad6a0559381f5d933442" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||
"cspell.nvim": { "branch": "main", "commit": "07d75238648ef99c0c5c05f4cfd83093d0a01dd4" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "4ec7bed6c86b671ddde03ca1b227343cfa3e65fa" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "4666d040b60d1dc0e474ccd9a3fd3c4d67b4767c" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "b3f9412b1ed76f14cfc68e1ee899873544330c80" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "736f51d2bb684c06f39a2032f064d7244f549981" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "482517700eef8579b289a20995f017a0775a6ec4" },
|
||||
"heirline.nvim": { "branch": "master", "commit": "fae936abb5e0345b85c3a03ecf38525b0828b992" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"leetcode.nvim": { "branch": "master", "commit": "74f2987292efbe0ba198a35d0ea412c5ae19d31c" },
|
||||
"leetcode.nvim": { "branch": "master", "commit": "422b6beb4a64eca0524fbff94edd9550c156afc5" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "7815740f4d0afb74ada00956c36e18ad695ed9e3" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "844d247d998c2f9a6a3baad8bb9748edc55ce69f" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
|
||||
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
|
||||
"mini.pairs": { "branch": "main", "commit": "42407ccb80ec59c84e7c91d815f42ed90a8cc093" },
|
||||
"mason.nvim": { "branch": "main", "commit": "9e25c98d4826998460926f8c5c2284848d80ae89" },
|
||||
"mini.pairs": { "branch": "main", "commit": "1e1ca3f60f58d4050bf814902b472eec9963a5dd" },
|
||||
"mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "84c3df0aa276da7f6095b000de314986f7b5ac98" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "1280212f9308e13cb3c0e9a27b90024aa2bb7a89" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "46fa0c22ca39e05fe15744102d21feb07fe9a94a" },
|
||||
"neotest": { "branch": "master", "commit": "3c81345c28cd639fcc02843ed3653be462f47024" },
|
||||
"neotest-bun": { "branch": "main", "commit": "23afafb890928c13ca05b692eae8570c11c5c20e" },
|
||||
"neotest-jest": { "branch": "main", "commit": "46ccc50273838f0b48e3c4814c1c46c0ccfe9edf" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "46f2713c88a0b4e4bf134b59577659851ddd31cf" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "dbdb80d3bd311989d21029c63918d67a786d5013" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "63a38440989c58e1f100373ab603fd24665bdc9a" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "a1366758b3a232036dc97be8ca41184aa3f50506" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "3362099de3368aa620a8105b19ed04c2053e38c0" },
|
||||
"nvim-window-picker": { "branch": "main", "commit": "6382540b2ae5de6c793d4aa2e3fe6dbb518505ec" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"schemastore.nvim": { "branch": "main", "commit": "36fb914c0defa2274207e670182253508e5569d5" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"schemastore.nvim": { "branch": "main", "commit": "b7e9af87f062bcaee219f9d91bc157169bb20486" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
||||
"supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ return {
|
|||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||
end
|
||||
|
||||
-- map('<leader>a', vim.lsp.buf.code_action, 'Code Action', { 'n', 'x', 'v' })
|
||||
map('<leader>a', vim.lsp.buf.code_action, 'Code Action')
|
||||
|
||||
map('gr', require('telescope.builtin').lsp_references, 'Goto References')
|
||||
|
||||
|
|
@ -33,6 +33,7 @@ return {
|
|||
|
||||
map('<leader>fs', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
|
||||
|
||||
map('<f2>', vim.lsp.buf.rename, 'Rename')
|
||||
map('<leader>d', vim.diagnostic.open_float, 'Show Diagnostics')
|
||||
map('<leader>D', function()
|
||||
vim.diagnostic.jump({ count = 1, float = true })
|
||||
|
|
|
|||
|
|
@ -22,9 +22,7 @@ return {
|
|||
},
|
||||
},
|
||||
})
|
||||
vim.keymap.set('', '<leader>a', '<cmd>Lspsaga code_action<CR>')
|
||||
vim.keymap.set('n', 'K', '<cmd>Lspsaga hover_doc<CR>')
|
||||
vim.keymap.set('n', '<F2>', '<cmd>Lspsaga rename<CR>')
|
||||
end,
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter', -- optional
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
return {
|
||||
'nvim-neotest/neotest',
|
||||
dependencies = {
|
||||
'nvim-neotest/nvim-nio',
|
||||
'nvim-lua/plenary.nvim',
|
||||
'antoinemadec/FixCursorHold.nvim',
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'haydenmeade/neotest-jest',
|
||||
'arthur944/neotest-bun',
|
||||
},
|
||||
config = function()
|
||||
local neotest = require('neotest')
|
||||
|
||||
neotest.setup({
|
||||
adapters = {
|
||||
require('neotest-jest')({
|
||||
jestCommand = './node_modules/.bin/jest',
|
||||
jestConfigFile = function()
|
||||
local root = vim.fn.getcwd()
|
||||
|
||||
local config_files = {
|
||||
'jest.config.js',
|
||||
'jest.config.ts',
|
||||
'jest.config.mjs',
|
||||
'jest.config.cjs',
|
||||
}
|
||||
|
||||
for _, config_file in ipairs(config_files) do
|
||||
local config_path = root .. '/' .. config_file
|
||||
if vim.fn.filereadable(config_path) == 1 then
|
||||
return config_path
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end,
|
||||
}),
|
||||
require('neotest-bun'),
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<leader>tt', function()
|
||||
neotest.run.run()
|
||||
end, { desc = 'Run nearest test' })
|
||||
|
||||
vim.keymap.set('n', '<leader>tf', function()
|
||||
neotest.run.run(vim.fn.expand('%'))
|
||||
end, { desc = 'Run current file tests' })
|
||||
|
||||
vim.keymap.set('n', '<leader>td', function()
|
||||
neotest.output.open({ enter = true, auto_close = true })
|
||||
end, { desc = 'Display test output' })
|
||||
end,
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue