From 0bea6f238f21228c0c63e382fdb5ed2e6925b4ce Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Tue, 30 Sep 2025 20:44:19 +0200 Subject: [PATCH] fix(dap.hover): change format of expand marker --- lua/ow/dap/hover/node.lua | 20 ++++++++++++-------- lua/ow/dap/hover/window.lua | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/lua/ow/dap/hover/node.lua b/lua/ow/dap/hover/node.lua index 012a28d..735e42b 100644 --- a/lua/ow/dap/hover/node.lua +++ b/lua/ow/dap/hover/node.lua @@ -212,16 +212,9 @@ end ---@param content ow.dap.hover.Content function Node:format_into(content) - if self:is_expandable() then - local marker = self.is_expanded and "-" or "+" - content:add(marker .. " ", "@comment") - else - content:add(" ") - end - local tree_prefix = self:get_tree_prefix() if tree_prefix ~= "" then - content:add(tree_prefix, "@comment") + content:add(tree_prefix, "DapHoverPrefix") end local text @@ -232,6 +225,17 @@ function Node:format_into(content) end content:add_with_treesitter(text, self.lang) + + if self:is_expandable() then + if self.is_expanded then + for _, child in ipairs(self.children) do + content:newline() + child:format_into(content) + end + else + content:add(" ...", "DapHoverExpandMarker") + end + end end ---@async diff --git a/lua/ow/dap/hover/window.lua b/lua/ow/dap/hover/window.lua index aa152c3..e3a55bf 100644 --- a/lua/ow/dap/hover/window.lua +++ b/lua/ow/dap/hover/window.lua @@ -17,6 +17,21 @@ Window.__index = Window Window.NAMESPACE = "ow.dap.hover.Window" Window.NS_ID = vim.api.nvim_create_namespace(Window.NAMESPACE) +local function setup_highlights() + vim.api.nvim_set_hl(0, "DapHoverPrefix", { + link = "@comment", + }) + vim.api.nvim_set_hl(0, "DapHoverExpandMarker", { + link = "@comment", + }) +end + +setup_highlights() + +vim.api.nvim_create_autocmd("ColorScheme", { + callback = setup_highlights, +}) + local instance = nil ---@param session dap.Session