Skip to content

Commit

Permalink
feat: update render settings
Browse files Browse the repository at this point in the history
See #161
  • Loading branch information
rcarriga committed Nov 5, 2022
1 parent 6a82715 commit 0f385f7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
11 changes: 10 additions & 1 deletion doc/nvim-dap-ui.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
================================================================================
*nvim-dap-ui*
NVIM-DAP-UI *nvim-dap-ui*

dapui.float_element({elem_name}, {settings}) *dapui.float_element()*
Open a floating window containing the desired element.
Expand Down Expand Up @@ -42,6 +42,15 @@ dapui.eval({expr}, {settings}) *dapui.eval()*
{enter} (boolean) Whether or not to enter the window after opening


dapui.update_render({update}) *dapui.update_render()*
Update the config.render settings and re-render windows


Parameters: ~
{update} (table) Updated settings, from the `render` table of the
config


dapui.close({opts}) *dapui.close()*
Close one or all of the window layouts

Expand Down
4 changes: 4 additions & 0 deletions lua/dapui/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ function M.render()
return user_config.render
end

function M.update_render(update)
user_config.render = vim.tbl_deep_extend("keep", update, user_config.render)
end

function M.expand_lines()
return user_config.expand_lines
end
Expand Down
8 changes: 8 additions & 0 deletions lua/dapui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ function dapui.setup(user_config)
end)
end

---Update the config.render settings and re-render windows
---@param update table: Updated settings, from the `render` table of the config
function dapui.update_render(update)
config.update_render(update)
local render = require("dapui.render")
render.loop.run()
end

local function keep_cmdheight(cb)
local cmd_height = vim.o.cmdheight

Expand Down
2 changes: 1 addition & 1 deletion lua/dapui/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function M.render_type(maybe_type)
return ""
end
local max_length = config.render().max_type_length
if not max_length then
if not max_length or max_length == -1 then
return maybe_type
end
if max_length == 0 then
Expand Down

0 comments on commit 0f385f7

Please sign in to comment.