Skip to content

Commit

Permalink
feat(summary): 'debug' and 'debug_marked' mappings (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEmmons authored Nov 12, 2022
1 parent 31dde8e commit 6bcd743
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion doc/neotest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ Default values:
output = "o",
prev_failed = "K",
run = "r",
debug = "d",
run_marked = "R",
debug_marked = "D",
short = "O",
stop = "u",
target = "t"
Expand Down Expand Up @@ -244,8 +246,10 @@ Fields~
{jumpto} `(string|string[])` Jump to the selected position
{stop} `(string|string[])` Stop selected position
{run} `(string|string[])` Run selected position
{debug} `(string|string[])` Debug selected position
{mark} `(string|string[])` Mark the selected position
{run_marked} `(string|string[])` Run the marked positions for selected suite.
{debug_marked} `(string|string[])` Debug the marked positions for selected suite.
{clear_marked} `(string|string[])` Clear the marked positions for selected suite.
{target} `(string|string[])` Target a position to be the only shown position for its adapter
{clear_target} `(string|string[])` Clear the target position for the selected adapter
Expand Down Expand Up @@ -544,4 +548,4 @@ Fields~
{status} `(string)` Only jump to positions with given status


vim:tw=78:ts=8:noet:ft=help:norl:
vim:tw=78:ts=8:noet:ft=help:norl:
4 changes: 4 additions & 0 deletions lua/neotest/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ define_highlights()
---@field jumpto string|string[] Jump to the selected position
---@field stop string|string[] Stop selected position
---@field run string|string[] Run selected position
---@field debug string|string[] Debug selected position
---@field mark string|string[] Mark the selected position
---@field run_marked string|string[] Run the marked positions for selected suite.
---@field debug_marked string|string[] Debug the marked positions for selected suite.
---@field clear_marked string|string[] Clear the marked positions for selected suite.
---@field target string|string[] Target a position to be the only shown position for its adapter
---@field clear_target string|string[] Clear the target position for the selected adapter
Expand Down Expand Up @@ -194,8 +196,10 @@ local default_config = {
jumpto = "i",
stop = "u",
run = "r",
debug = "d",
mark = "m",
run_marked = "R",
debug_marked = "D",
clear_marked = "M",
target = "t",
clear_target = "T",
Expand Down
8 changes: 8 additions & 0 deletions lua/neotest/consumers/summary/component.lua
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ function SummaryComponent:_render(canvas, tree, expanded, focused, indent)
neotest.run.run({ position.id, adapter = self.adapter_id })
end)

canvas:add_mapping("debug", function()
neotest.run.run({ position.id, adapter = self.adapter_id, strategy = "dap" })
end)

canvas:add_mapping("mark", function()
self.marked[position.id] = not self.marked[position.id]
neotest.summary.render()
Expand All @@ -213,6 +217,10 @@ function SummaryComponent:_render(canvas, tree, expanded, focused, indent)
neotest.summary.run_marked({ adapter = self.adapter_id })
end)

canvas:add_mapping("debug_marked", function()
neotest.summary.run_marked({ adapter = self.adapter_id, strategy = "dap" })
end)

canvas:add_mapping("clear_marked", function()
neotest.summary.clear_marked({ adapter = self.adapter_id })
end)
Expand Down

0 comments on commit 6bcd743

Please sign in to comment.