summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaël Ball <michael.ball@krotosaudio.com>2024-07-24 11:05:17 +0100
committerMichaël Ball <michael.ball@krotosaudio.com>2024-07-24 11:05:17 +0100
commitc221640062db060ccab5d39464c1cc17e9e0d9ea (patch)
treeffdd22410ac41cac75676b172d75465b24c9f492
parentce7f2620d1e53ea9438a4d9c494bb5da4219888d (diff)
Add neotest
-rw-r--r--neovim/.config/nvim/lua/plugins/nvim_dap.lua64
1 files changed, 39 insertions, 25 deletions
diff --git a/neovim/.config/nvim/lua/plugins/nvim_dap.lua b/neovim/.config/nvim/lua/plugins/nvim_dap.lua
index 1a3a12a..448609f 100644
--- a/neovim/.config/nvim/lua/plugins/nvim_dap.lua
+++ b/neovim/.config/nvim/lua/plugins/nvim_dap.lua
@@ -5,21 +5,27 @@ return {
'mfussenegger/nvim-dap-python',
'rcarriga/nvim-dap-ui',
'nvim-neotest/nvim-nio',
+ {
+ 'nvim-neotest/neotest',
+ dependencies = {
+ 'nvim-neotest/neotest-python',
+ }
+ },
},
config = function()
- local dap = require'dap'
+ local dap = require 'dap'
vim.fn.sign_define('DapBreakpoint', {
- text = '⬤',
- texthl = 'ErrorMsg',
- linehl = '',
- numhl = 'ErrorMsg'
+ text = '⬤',
+ texthl = 'ErrorMsg',
+ linehl = '',
+ numhl = 'ErrorMsg'
})
vim.fn.sign_define('DapBreakpointCondition', {
- text = '⬤',
- texthl = 'ErrorMsg',
- linehl = '',
- numhl = 'SpellBad'
+ text = '⬤',
+ texthl = 'ErrorMsg',
+ linehl = '',
+ numhl = 'SpellBad'
})
local pythonPath = function()
@@ -35,10 +41,10 @@ return {
require('dap-python').setup() -- earlier so setup the various defaults ready to be replaced
dap.configurations.python = {
{
- type = 'python';
- request = 'launch';
- name = "Launch file";
- program = "${file}";
+ type = 'python',
+ request = 'launch',
+ name = "Launch file",
+ program = "${file}",
pythonPath = pythonPath()
},
{
@@ -46,31 +52,31 @@ return {
request = 'launch',
name = 'DAP Django',
program = vim.loop.cwd() .. '/manage.py',
- args = {'runserver', '--noreload'},
+ args = { 'runserver', '--noreload' },
justMyCode = true,
django = true,
console = "integratedTerminal",
},
{
- type = 'python';
- request = 'attach';
- name = 'Attach remote';
+ type = 'python',
+ request = 'attach',
+ name = 'Attach remote',
connect = function()
return {
host = '127.0.0.1',
port = 5678
}
- end;
+ end,
},
{
- type = 'python';
- request = 'launch';
- name = 'Launch file with arguments';
- program = '${file}';
+ type = 'python',
+ request = 'launch',
+ name = 'Launch file with arguments',
+ program = '${file}',
args = function()
local args_string = vim.fn.input('Arguments: ')
return vim.split(args_string, " +")
- end;
+ end,
console = "integratedTerminal",
pythonPath = pythonPath()
}
@@ -79,16 +85,24 @@ return {
dap.adapters.python = {
type = 'executable',
command = pythonPath(),
- args = {'-m', 'debugpy.adapter'}
+ args = { '-m', 'debugpy.adapter' }
}
end
set_python_dap()
- vim.api.nvim_create_autocmd({"DirChanged"}, {
+ vim.api.nvim_create_autocmd({ "DirChanged" }, {
callback = function() set_python_dap() end,
})
require("dapui").setup()
+
+ require("neotest").setup({
+ adapters = {
+ require("neotest-python")({
+ dap = { django = true },
+ }),
+ }
+ })
end,
},
}