Skip to content

Commit 905ac13

Browse files
committed
Revert "feat: auto compile before debug"
1 parent 9963a21 commit 905ac13

File tree

4 files changed

+3
-44
lines changed

4 files changed

+3
-44
lines changed

.github/workflows/lint_code.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ jobs:
77
- uses: actions/checkout@v4
88
- uses: lunarmodules/luacheck@v1
99
with:
10-
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
10+
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

lua/keymap/helpers.lua

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -164,40 +164,3 @@ function _G.toggle_nvsmi()
164164
end
165165
end
166166
end
167-
168-
_G._async_compile_and_debug = function()
169-
local file_ext = vim.fn.expand("%:e")
170-
local file_path = vim.fn.expand("%:p")
171-
local out_name = vim.fn.expand("%:p:h") .. "/" .. vim.fn.expand("%:t:r") .. ".out"
172-
local compile_cmd
173-
if file_ext == "cpp" or file_ext == "cc" then
174-
compile_cmd = string.format("g++ -g %s -o %s", file_path, out_name)
175-
elseif file_ext == "c" then
176-
compile_cmd = string.format("gcc -g %s -o %s", file_path, out_name)
177-
elseif file_ext == "go" then
178-
compile_cmd = string.format("go build -o %s %s", out_name, file_path)
179-
else
180-
require("dap").continue()
181-
return
182-
end
183-
local notify_title = "Debug Pre-compile"
184-
vim.fn.jobstart(compile_cmd, {
185-
on_exit = function(_, exit_code, _)
186-
if exit_code == 0 then
187-
vim.notify(
188-
"Compilation succeeded! Executable: " .. out_name,
189-
vim.log.levels.INFO,
190-
{ title = notify_title }
191-
)
192-
require("dap").continue()
193-
return
194-
else
195-
vim.notify(
196-
"Compilation failed with exit code: " .. exit_code,
197-
vim.log.levels.ERROR,
198-
{ title = notify_title }
199-
)
200-
end
201-
end,
202-
})
203-
end

lua/keymap/tool.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ local mappings = {
174174

175175
-- Plugin: dap
176176
["n|<F6>"] = map_callback(function()
177-
_async_compile_and_debug()
177+
require("dap").continue()
178178
end)
179179
:with_noremap()
180180
:with_silent()

lua/modules/utils/dap.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ function M.input_args()
66
end
77

88
function M.input_exec_path()
9-
return vim.fn.input(
10-
'Path to executable (default to "filename.out"): ',
11-
vim.fn.expand("%:p:h") .. "/" .. vim.fn.expand("%:t:r") .. ".out",
12-
"file"
13-
)
9+
return vim.fn.input('Path to executable (default to "a.out"): ', vim.fn.expand("%:p:h") .. "/a.out", "file")
1410
end
1511

1612
function M.input_file_path()

0 commit comments

Comments
 (0)