Skip to content

Commit ed40313

Browse files
committed
feat(hover): custom border (#188) (#189)
1 parent 3701c85 commit ed40313

6 files changed

Lines changed: 28 additions & 0 deletions

File tree

doc/dap-view.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ You don't have to copy and paste these options. Use them as a reference.
221221
help = {
222222
border = nil,
223223
},
224+
hover = {
225+
border = nil,
226+
},
224227
render = {
225228
-- Optionally a function that takes two `dap.Variable`'s as arguments
226229
-- and is forwarded to a `table.sort` when rendering variables in the scopes view

docs/src/routes/configuration/+page.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ return {
142142
help = {
143143
border = nil,
144144
},
145+
hover = {
146+
border = nil,
147+
},
145148
render = {
146149
-- Optionally a function that takes two `dap.Variable`'s as arguments
147150
-- and is forwarded to a `table.sort` when rendering variables in the scopes view

lua/dap-view/actions.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ M.hover = function(expr, enter, opts)
232232
local col = anchor_x == "E" and 1 or 0
233233

234234
local winnr = api.nvim_open_win(bufnr, enter or enter == nil, {
235+
border = setup.config.hover.border,
235236
relative = "cursor",
236237
row = row,
237238
col = col,

lua/dap-view/config.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ local M = {}
8080
---@class dapview.HelpConfig
8181
---@field border? string|string[] Override `winborder` in the help window
8282

83+
---@class dapview.HoverConfig
84+
---@field border? string|string[] Override `winborder` in the hover window
85+
8386
---@class dapview.RenderBreakpointsConfig
8487
---@field format fun(line: string, lnum: string, path: string): dapview.Content[]
8588
---@field align boolean
@@ -165,6 +168,7 @@ local M = {}
165168
---@field winbar dapview.WinbarConfig
166169
---@field windows dapview.WindowsConfig
167170
---@field help dapview.HelpConfig
171+
---@field hover dapview.HoverConfig
168172
---@field render dapview.RenderConfig
169173
---@field keymaps dapview.KeymapsConfig
170174
---@field icons dapview.IconsConfig Icons for each button
@@ -292,6 +296,9 @@ M.config = {
292296
help = {
293297
border = nil,
294298
},
299+
hover = {
300+
border = nil,
301+
},
295302
render = {
296303
sort_variables = nil,
297304
threads = {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
local M = {}
2+
3+
---@param config dapview.HoverConfig
4+
function M.validate(config)
5+
local validate = require("dap-view.setup.validate.util").validate
6+
7+
validate("hover", {
8+
border = { config.border, { "string", "table", "nil" } },
9+
}, config)
10+
end
11+
12+
return M

lua/dap-view/setup/validate/init.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ function M.validate(config)
66
windows = { config.windows, "table" },
77
winbar = { config.winbar, "table" },
88
help = { config.help, "table" },
9+
hover = { config.hover, "table" },
910
render = { config.render, "table" },
1011
switchbuf = { config.switchbuf, { "string", "function" } },
1112
keymaps = { config.keymaps, { "table" } },
@@ -25,6 +26,7 @@ function M.validate(config)
2526
require("dap-view.setup.validate.winbar").validate(config.winbar)
2627
require("dap-view.setup.validate.windows").validate(config.windows)
2728
require("dap-view.setup.validate.help").validate(config.help)
29+
require("dap-view.setup.validate.hover").validate(config.hover)
2830
require("dap-view.setup.validate.icons").validate(config.icons)
2931
require("dap-view.setup.validate.virtual-text").validate(config.virtual_text)
3032
require("dap-view.setup.validate.render").validate(config.render)

0 commit comments

Comments
 (0)