Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/nvim-dap-ui.txt
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ render order of variables.

*dapui.Action*
Alias~
`dapui.Action` → `"expand"|"open"|"remove"|"edit"|"repl"|"toggle"`
`dapui.Action` → `"expand"|"open"|"remove"|"edit"|"repl"|"toggle"|"watch"`

*dapui.FloatingAction*
Alias~
Expand All @@ -347,6 +347,7 @@ Mappings:
- `edit`: Edit the value of a variable
- `expand`: Toggle showing any children of variable.
- `repl`: Send variable to REPL
- `watch`: Send variable to watches


==============================================================================
Expand Down
1 change: 1 addition & 0 deletions lua/dapui/components/variables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ return function(client, send_ready)
end)
if variable.evaluateName then
canvas:add_mapping("repl", partial(util.send_to_repl, variable.evaluateName))
canvas:add_mapping("watch", partial(util.send_to_watches, variable.evaluateName))
end
end
canvas:add_mapping("edit", function()
Expand Down
3 changes: 2 additions & 1 deletion lua/dapui/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ local dapui = {}
---@field sort_variables? fun(a: dapui.types.Variable, b: dapui.types.Variable):boolean Sorting function to determine
--- render order of variables.

---@alias dapui.Action "expand"|"open"|"remove"|"edit"|"repl"|"toggle"
---@alias dapui.Action "expand"|"open"|"remove"|"edit"|"repl"|"toggle"|"watch"

---@alias dapui.FloatingAction "close"

Expand All @@ -86,6 +86,7 @@ local default_config = {
edit = "e",
repl = "r",
toggle = "t",
watch = "w",
},
element_mappings = {},
expand_lines = vim.fn.has("nvim-0.7") == 1,
Expand Down
2 changes: 1 addition & 1 deletion lua/dapui/render/canvas.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ M.namespace = api.nvim_create_namespace("dapui")
local Canvas = {}

---@type dapui.Action[]
local all_actions = { "expand", "open", "remove", "edit", "repl", "toggle" }
local all_actions = { "expand", "open", "remove", "edit", "repl", "toggle", "watch" }

---@return dapui.Canvas
function Canvas:new()
Expand Down
4 changes: 4 additions & 0 deletions lua/dapui/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ function M.send_to_repl(expression)
vim.cmd("normal i" .. expression)
end

function M.send_to_watches(expression)
require('dapui').elements.watches.add(expression)
end

function M.float_element(elem_name)
local line_no = vim.fn.screenrow()
local col_no = vim.fn.screencol()
Expand Down