File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 7373M .add_expr = function ()
7474 local expression = expr .eval_expression ()
7575
76- table.insert ( state . watched_expressions , expression )
76+ require ( " dap-view.watches.actions " ). add_watch_expr ( expression )
7777
7878 require (" dap-view.watches.view" ).show ()
7979end
Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ M.set_keymaps = function()
3232 vim .keymap .set (" n" , " i" , function ()
3333 if state .current_section == " watches" then
3434 vim .ui .input ({ prompt = " Expression: " }, function (input )
35- if input and # input > 0 then
36- table.insert ( state . watched_expressions , input )
35+ if input then
36+ require ( " dap-view.watches.actions " ). add_watch_expr ( input )
3737
3838 require (" dap-view.watches.view" ).show ()
3939 end
Original file line number Diff line number Diff line change 1+ local state = require (" dap-view.state" )
2+
3+ local M = {}
4+
5+ --- @param expr string
6+ M .add_watch_expr = function (expr )
7+ -- Avoid duplicate expressions
8+ local can_add = # expr > 0 and not vim .tbl_contains (state .watched_expressions , expr )
9+ if can_add then
10+ table.insert (state .watched_expressions , expr )
11+ end
12+ return can_add
13+ end
14+
15+ return M
You can’t perform that action at this time.
0 commit comments