From 9f6357ef3ae493b457eee411481b32ed8031a086 Mon Sep 17 00:00:00 2001 From: SamPosh Date: Thu, 20 Apr 2023 14:44:53 +0530 Subject: [PATCH] Update debug.lua --- lua/kickstart/plugins/debug.lua | 56 +++++---------------------------- 1 file changed, 7 insertions(+), 49 deletions(-) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index a0968b1b..4c43993f 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -38,55 +38,11 @@ return { -- In below way also we can setup debugger for python -- Need to install pip3 install debugpy. In dockerfile it is already there. If you are using configuation alone -- without dockerfile then install debugpy or mention the python path where debugpy is installed. - --[[ + handlers = { - python = function() - dap.adapters.python = { - type = "executable", - command = "/usr/local/bin/python", -- use "which python" command and provide the python path - args = { - "-m", - "debugpy.adapter", - }, - } - - dap.configurations.python = { - { - type = "python", - request = "launch", - name = "Launch file", - program = "${file}", -- This configuration will launch the current file if used. - console= "integratedTerminal", - }, - { - name= "Pytest: Current File", - type= "python", - request= "launch", - module= "pytest", - args= { - "${file}", - "-sv", - "--log-cli-level=INFO", - "--log-file=tc_medusa.log" - }, - console= "integratedTerminal", - }, - { - name= "Profile python: Current File", - type= "python", - request= "launch", - module= "cProfile", - args= { - "-o", - "/tmp/profile.dat", - "${file}" - }, - console= "integratedTerminal", - }, - } - end, - }, - --]] + -- python debug configuration is moved to this file + python = require('kickstart.plugins.dap.handler.python'), + }, -- You'll need to check that you have the required things installed -- online, please don't ask me how to install them :) @@ -136,7 +92,8 @@ return { dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close - -- Install python specific config + -- Install python specific config can be done below way as well instead of handler + --[[ require('dap-python').setup() -- Debug with default settings. -- We can set additional custom config by below mechanism as well table.insert(require('dap').configurations.python, { @@ -147,6 +104,7 @@ return { cwd = vim.fn.getcwd(), console= "integratedTerminal", }) + --]] end, }