From c221640062db060ccab5d39464c1cc17e9e0d9ea Mon Sep 17 00:00:00 2001 From: Michaël Ball Date: Wed, 24 Jul 2024 11:05:17 +0100 Subject: Add neotest --- neovim/.config/nvim/lua/plugins/nvim_dap.lua | 64 +++++++++++++++++----------- 1 file changed, 39 insertions(+), 25 deletions(-) (limited to 'neovim') 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, }, } -- cgit v1.2.3