From e3f8b2ce15b57ab2c434a7732d8bf27dd3ccdc6a Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Sat, 27 Sep 2025 02:32:14 +0200 Subject: [PATCH] fix(dap.hover): clean up constructors --- lua/ow/dap/hover/node.lua | 4 +--- lua/ow/dap/hover/window.lua | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lua/ow/dap/hover/node.lua b/lua/ow/dap/hover/node.lua index e8e8061..1e93ca7 100644 --- a/lua/ow/dap/hover/node.lua +++ b/lua/ow/dap/hover/node.lua @@ -11,15 +11,13 @@ Node.__index = Node ---@param parent ow.dap.hover.Node? ---@return ow.dap.hover.Node function Node.new(item, parent) - local node = setmetatable({ + return setmetatable({ item = item, parent = parent, children = {}, is_expanded = false, is_last_child = false, }, Node) - - return node end ---@return boolean diff --git a/lua/ow/dap/hover/window.lua b/lua/ow/dap/hover/window.lua index 9f50884..eb4ded4 100644 --- a/lua/ow/dap/hover/window.lua +++ b/lua/ow/dap/hover/window.lua @@ -20,16 +20,18 @@ local instance = nil ---@return ow.dap.hover.Window function Window.get_instance() - if not instance then - instance = setmetatable({ - max_width = nil, - max_height = nil, - winid = nil, - bufnr = nil, - augroup = nil, - }, Window) + if instance then + return instance end + instance = setmetatable({ + max_width = nil, + max_height = nil, + winid = nil, + bufnr = nil, + augroup = nil, + }, Window) + return instance end