diff --git a/.github/workflows/lint_code.yml b/.github/workflows/lint_code.yml index e9f7c470a..52b7ec48b 100644 --- a/.github/workflows/lint_code.yml +++ b/.github/workflows/lint_code.yml @@ -8,4 +8,4 @@ jobs: - uses: actions/checkout@v4 - uses: lunarmodules/luacheck@v1 with: - args: . --std luajit --globals vim _debugging _command_panel _flash_esc_or_noh _telescope_collections _toggle_lazygit _toggle_diagnostic _toggle_inlayhint _async_compile_and_debug --max-line-length 150 --no-config + args: . --std luajit --globals vim _debugging _command_panel _flash_esc_or_noh _telescope_collections _toggle_lazygit _toggle_diagnostic _toggle_inlayhint --max-line-length 150 --no-config diff --git a/lua/keymap/helpers.lua b/lua/keymap/helpers.lua index d37fe4160..afd6673ec 100644 --- a/lua/keymap/helpers.lua +++ b/lua/keymap/helpers.lua @@ -89,39 +89,3 @@ _G._toggle_lazygit = function() vim.notify("Command [lazygit] not found!", vim.log.levels.ERROR, { title = "toggleterm.nvim" }) end end -_G._async_compile_and_debug = function() - local file_ext = vim.fn.expand("%:e") - local file_path = vim.fn.expand("%:p") - local out_name = vim.fn.expand("%:p:h") .. "/" .. vim.fn.expand("%:t:r") .. ".out" - local compile_cmd - if file_ext == "cpp" or file_ext == "cc" then - compile_cmd = string.format("g++ -g %s -o %s", file_path, out_name) - elseif file_ext == "c" then - compile_cmd = string.format("gcc -g %s -o %s", file_path, out_name) - elseif file_ext == "go" then - compile_cmd = string.format("go build -o %s %s", out_name, file_path) - else - require("dap").continue() - return - end - local notify_title = "Debug Pre-compile" - vim.fn.jobstart(compile_cmd, { - on_exit = function(_, exit_code, _) - if exit_code == 0 then - vim.notify( - "Compilation succeeded! Executable: " .. out_name, - vim.log.levels.INFO, - { title = notify_title } - ) - require("dap").continue() - return - else - vim.notify( - "Compilation failed with exit code: " .. exit_code, - vim.log.levels.ERROR, - { title = notify_title } - ) - end - end, - }) -end diff --git a/lua/keymap/tool.lua b/lua/keymap/tool.lua index 44ccf2935..c32304a68 100644 --- a/lua/keymap/tool.lua +++ b/lua/keymap/tool.lua @@ -151,7 +151,7 @@ local mappings = { -- Plugin: dap ["n|"] = map_callback(function() - _async_compile_and_debug() + require("dap").continue() end) :with_noremap() :with_silent() diff --git a/lua/modules/utils/dap.lua b/lua/modules/utils/dap.lua index cfea2c7ed..0ea276c7c 100644 --- a/lua/modules/utils/dap.lua +++ b/lua/modules/utils/dap.lua @@ -6,11 +6,7 @@ function M.input_args() end function M.input_exec_path() - return vim.fn.input( - 'Path to executable (default to "filename.out"): ', - vim.fn.expand("%:p:h") .. "/" .. vim.fn.expand("%:t:r") .. ".out", - "file" - ) + return vim.fn.input('Path to executable (default to "a.out"): ', vim.fn.expand("%:p:h") .. "/a.out", "file") end function M.input_file_path()