Skip to content
Merged
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
6 changes: 4 additions & 2 deletions lua/dap-view/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ M.open = function()
local windows_config = setup.config.windows

local term_position = require("dap-view.util").inverted_directions[windows_config.terminal.position]
local anchor_win = windows_config.anchor and windows_config.anchor()
local is_anchor_win_valid = anchor_win and api.nvim_win_is_valid(anchor_win)

local winnr = api.nvim_open_win(bufnr, false, {
split = is_term_win_valid and term_position or windows_config.position,
win = is_term_win_valid and term_winnr or -1,
split = (is_anchor_win_valid or is_term_win_valid) and term_position or windows_config.position,
win = is_anchor_win_valid and anchor_win or is_term_win_valid and term_winnr or -1,
height = windows_config.height < 1 and math.floor(vim.go.lines * windows_config.height)
or windows_config.height,
})
Expand Down
1 change: 1 addition & 0 deletions lua/dap-view/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ local M = {}
---@class dapview.WindowsConfig
---@field height integer If > 1 number of lines, else percentage the windows should use
---@field position 'right' | 'left' | 'above' | 'below'
---@field anchor? fun(): integer? Function that returns a window number for the main nvim-dap-view window to follow
---@field terminal dapview.TerminalConfig

---@class dapview.WinbarHeaders
Expand Down
8 changes: 1 addition & 7 deletions lua/dap-view/setup/validate/help.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ function M.validate(config)
local validate = require("dap-view.setup.validate.util").validate

validate("help", {
border = {
config.border,
function(v)
return v == nil or type(v) == "string" or type(v) == "table"
end,
"string|string[]|nil",
},
border = { config.border, { "string", "table", "nil" } },
}, config)
end

Expand Down
1 change: 1 addition & 0 deletions lua/dap-view/setup/validate/windows.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function M.validate(config)
height = { config.height, "number" },
position = { config.position, "string" },
terminal = { config.terminal, "table" },
anchor = { config.anchor, { "function", "nil" } },
}, config)

validate("windows.terminal", {
Expand Down