Skip to content

Commit 78cbea3

Browse files
author
Marc Jakobi
committed
fix(neotest): undo sanitize command for debugging in normal strategy
1 parent 553a319 commit 78cbea3

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ All notable changes to this project will be documented in this file.
66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## [4.22.2] - 2024-04-14
10+
11+
### Fixed
12+
13+
- Neotest/DAP: Undo sanitize command for debugging when running with
14+
a non-dap strategy, in case it was sanitized during a dap strategy run.
15+
916
## [4.22.1] - 2024-04-14
1017

1118
### Fixed

lua/rustaceanvim/neotest/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ local lib = require('neotest.lib')
3131
local nio = require('nio')
3232
local trans = require('rustaceanvim.neotest.trans')
3333
local cargo = require('rustaceanvim.cargo')
34+
local overrides = require('rustaceanvim.overrides')
3435

3536
---@package
3637
---@type neotest.Adapter
@@ -239,7 +240,6 @@ function NeotestAdapter.build_spec(run_args)
239240
local exe, args, cwd = require('rustaceanvim.runnables').get_command(runnable)
240241
if run_args.strategy == 'dap' then
241242
local dap = require('rustaceanvim.dap')
242-
local overrides = require('rustaceanvim.overrides')
243243
overrides.sanitize_command_for_debugging(runnable.args.cargoArgs)
244244
local future = nio.control.future()
245245
dap.start(runnable.args, false, function(strategy)
@@ -260,6 +260,8 @@ function NeotestAdapter.build_spec(run_args)
260260
strategy = strategy,
261261
}
262262
return run_spec
263+
else
264+
overrides.undo_debug_sanitize(runnable.args.cargoArgs)
263265
end
264266
---@type rustaceanvim.neotest.RunSpec
265267
---@diagnostic disable-next-line: missing-fields

lua/rustaceanvim/overrides.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,14 @@ function M.sanitize_command_for_debugging(command)
7171
end
7272
end
7373

74+
---Undo sanitize_command_for_debugging.
75+
---@param command string[]
76+
function M.undo_debug_sanitize(command)
77+
if command[1] == 'build' then
78+
command[1] = 'run'
79+
elseif command[1] == 'test' and command[2] == '--no-run' then
80+
table.remove(command, 2)
81+
end
82+
end
83+
7484
return M

0 commit comments

Comments
 (0)