refactor(#2826): singleton View class, WIP
This commit is contained in:
parent
88b102fd19
commit
6f733c000b
@ -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 core = require("nvim-tree.core")
|
||||||
local view = require("nvim-tree.view")
|
local view = require("nvim-tree.view")
|
||||||
|
|||||||
@ -16,13 +16,13 @@ local DEFAULT_MIN_WIDTH = 30
|
|||||||
local DEFAULT_MAX_WIDTH = -1
|
local DEFAULT_MAX_WIDTH = -1
|
||||||
local DEFAULT_PADDING = 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
|
---@class (exact) View: Class
|
||||||
---@field live_filter table
|
---@field live_filter table
|
||||||
---@field side string
|
---@field side string
|
||||||
---@field float table
|
---@field float table
|
||||||
---TODO private below here
|
---TODO #2826 private below here
|
||||||
---@field explorer Explorer
|
---@field explorer Explorer
|
||||||
---@field adaptive_size boolean
|
---@field adaptive_size boolean
|
||||||
---@field centralize_selection boolean
|
---@field centralize_selection boolean
|
||||||
@ -42,6 +42,7 @@ local View = Class:extend()
|
|||||||
---@class View
|
---@class View
|
||||||
---@overload fun(args: ViewArgs): View
|
---@overload fun(args: ViewArgs): View
|
||||||
|
|
||||||
|
--TODO #2826 exact
|
||||||
---@class (exact) ViewArgs
|
---@class (exact) ViewArgs
|
||||||
---@field explorer Explorer
|
---@field explorer Explorer
|
||||||
|
|
||||||
@ -114,7 +115,7 @@ local tabinitial = {
|
|||||||
winnr = nil,
|
winnr = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- TODO member
|
-- TODO #2826 member
|
||||||
local BUFNR_PER_TAB = {}
|
local BUFNR_PER_TAB = {}
|
||||||
|
|
||||||
---@type { name: string, value: any }[]
|
---@type { name: string, value: any }[]
|
||||||
@ -678,11 +679,8 @@ function View:configure_width(width)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
M.View = View({
|
-- TODO #2826 move this to explorer constructor
|
||||||
explorer = {
|
M.View = View({ explorer = { opts = opts } }) ---@diagnostic disable-line: missing-fields
|
||||||
opts = opts
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user