From f2e9666b5039cc31c10360093d1cc2558674a9fa Mon Sep 17 00:00:00 2001 From: Yajie Zhu <15101230@qq.com> Date: Wed, 10 Aug 2022 09:29:58 +0800 Subject: [PATCH] remove duplicate code; Add LogPoint command (#200) * fix: use strict test function name while debugging * fix: use strict test function name while debugging * Revert "fix: use strict test function name while debugging" This reverts commit f47dd66c502fc94cda4cf748b2993e7e20f4b64a. * fix: GoPkgOutline, should reset pkg_info data before rerender * remove duplicate code; add GoLogPoint command Co-authored-by: zhuyajie <930664@qq.com> --- lua/go/commands.lua | 45 +++++++-------------------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/lua/go/commands.lua b/lua/go/commands.lua index d228e52..730b256 100644 --- a/lua/go/commands.lua +++ b/lua/go/commands.lua @@ -14,6 +14,13 @@ local dap_config = function() end dap.set_breakpoint(vfn.input('Breakpoint condition: ')) end) + create_cmd('LogPoint', function(_) + local dap = utils.load_plugin('nvim-dap', 'dap') + if not dap then + return + end + dap.set_breakpoint(nil,nil,vfn.input('Log message: ')) + end) create_cmd('ReplRun', function(_) local dap = utils.load_plugin('nvim-dap', 'dap') @@ -88,44 +95,6 @@ local dap_config = function() create_cmd('GoDbgKeys', function(_) gdap.debug_keys() end) - create_cmd('BreakCondition', function(_) - local dap = utils.load_plugin('nvim-dap', 'dap') - if not dap then - return - end - dap.set_breakpoint(vfn.input('Breakpoint condition: ')) - end) - create_cmd('ReplRun', function(_) - local dap = utils.load_plugin('nvim-dap', 'dap') - if not dap then - return - end - dap.repl.run_last() - end) - create_cmd('ReplToggle', function(_) - local dap = utils.load_plugin('nvim-dap', 'dap') - if not dap then - return - end - dap.repl.toggle() - end) - create_cmd('ReplOpen', function(_) - local dap = utils.load_plugin('nvim-dap', 'dap') - if not dap then - return - end - dap.open() - vim.cmd('split') - end) - create_cmd('DapRerun', function(_) - local dap = utils.load_plugin('nvim-dap', 'dap') - if not dap then - return - end - dap.disconnect() - dap.close() - dap.run_last() - end) create_cmd('DapUiFloat', function(_) require('dapui').float_element() end)