From b95b87362625fe0f59d1d4c9ed3ca5d3af565885 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 20 Apr 2025 13:57:12 +1000 Subject: [PATCH] refactor(#2826): singleton View class, WIP --- lua/nvim-tree/api.lua | 2 +- lua/nvim-tree/view.lua | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lua/nvim-tree/api.lua b/lua/nvim-tree/api.lua index 48054e31..ddb9baf7 100644 --- a/lua/nvim-tree/api.lua +++ b/lua/nvim-tree/api.lua @@ -1,4 +1,4 @@ ----TODO #2826 wrap all the view methods in explorer +-- TODO #2826 wrap all the view methods in explorer local core = require("nvim-tree.core") local view = require("nvim-tree.view") diff --git a/lua/nvim-tree/view.lua b/lua/nvim-tree/view.lua index 6757a367..2a463698 100644 --- a/lua/nvim-tree/view.lua +++ b/lua/nvim-tree/view.lua @@ -16,13 +16,13 @@ local DEFAULT_MIN_WIDTH = 30 local DEFAULT_MAX_WIDTH = -1 local DEFAULT_PADDING = 1 ---TODO attempt to type the tables, at least the options ones +-- TODO #2826 attempt to type the tables, at least the options ones ---@class (exact) View: Class ---@field live_filter table ---@field side string ---@field float table ----TODO private below here +---TODO #2826 private below here ---@field explorer Explorer ---@field adaptive_size boolean ---@field centralize_selection boolean @@ -42,6 +42,7 @@ local View = Class:extend() ---@class View ---@overload fun(args: ViewArgs): View +--TODO #2826 exact ---@class (exact) ViewArgs ---@field explorer Explorer @@ -114,7 +115,7 @@ local tabinitial = { winnr = nil, } --- TODO member +-- TODO #2826 member local BUFNR_PER_TAB = {} ---@type { name: string, value: any }[] @@ -683,11 +684,8 @@ function View:configure_width(width) end function M.setup(opts) - M.View = View({ - explorer = { - opts = opts - } - }) + -- TODO #2826 move this to explorer constructor + M.View = View({ explorer = { opts = opts } }) ---@diagnostic disable-line: missing-fields end return M