chore: migrate to classic (#2991)
* add classic, migrating nodes classes
* add mixins to classic
* typechecked optargs constructors for nodes
* typechecked optargs constructors for watcher and event
* luacheck
* typechecked optargs constructors for GitRunner
* typechecked optargs constructors for Sorter
* typechecked optargs constructors for decorators, WIP
* typechecked optargs constructors for decorators, WIP
* typechecked optargs constructors for decorators
* remove class
* replace enums with named maps
* Renderer and Builder use classic, tidy opts
* LiveFilter uses classic, tidy opts
* Filter uses classic, tidy opts
* add FilterTypes named map
* move toggles into filters
* Marks uses classic, tidy opts
* Sorter uses classic, tidy opts
* Clipboard uses classic, tidy opts
* use supers for node methods
* HighlightDisplay uses classic
* protected :new
* Watcher tidy
* Revert "use supers for node methods"
This reverts commit 9fc7a866ec.
* Watcher tidy
* format
* format
* Filters private methods
* format
* Sorter type safety
* Sorter type safety
* Sorter type safety
* Sorter type safety
* Sorter type safety
* Sorter type safety
* tidy Runner
* tidy hi-test name
This commit is contained in:
committed by
GitHub
parent
610a1c189b
commit
3fc8de198c
@@ -8,37 +8,33 @@ local rename_file = require("nvim-tree.actions.fs.rename-file")
|
||||
local trash = require("nvim-tree.actions.fs.trash")
|
||||
local utils = require("nvim-tree.utils")
|
||||
|
||||
local Class = require("nvim-tree.classic")
|
||||
local DirectoryNode = require("nvim-tree.node.directory")
|
||||
|
||||
---@class Marks
|
||||
---@field config table hydrated user opts.filters
|
||||
---@class (exact) Marks: Class
|
||||
---@field private explorer Explorer
|
||||
---@field private marks table<string, Node> by absolute path
|
||||
local Marks = {}
|
||||
local Marks = Class:extend()
|
||||
|
||||
---@return Marks
|
||||
---@param opts table user options
|
||||
---@param explorer Explorer
|
||||
function Marks:new(opts, explorer)
|
||||
local o = {
|
||||
explorer = explorer,
|
||||
config = {
|
||||
ui = opts.ui,
|
||||
filesystem_watchers = opts.filesystem_watchers,
|
||||
},
|
||||
marks = {},
|
||||
}
|
||||
---@class Marks
|
||||
---@overload fun(args: MarksArgs): Marks
|
||||
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
---@class (exact) MarksArgs
|
||||
---@field explorer Explorer
|
||||
|
||||
---@protected
|
||||
---@param args MarksArgs
|
||||
function Marks:new(args)
|
||||
self.explorer = args.explorer
|
||||
|
||||
self.marks = {}
|
||||
end
|
||||
|
||||
---Clear all marks and reload if watchers disabled
|
||||
---@private
|
||||
function Marks:clear_reload()
|
||||
self:clear()
|
||||
if not self.config.filesystem_watchers.enable then
|
||||
if not self.explorer.opts.filesystem_watchers.enable then
|
||||
self.explorer:reload_explorer()
|
||||
end
|
||||
end
|
||||
@@ -100,7 +96,7 @@ function Marks:bulk_delete()
|
||||
self:clear_reload()
|
||||
end
|
||||
|
||||
if self.config.ui.confirm.remove then
|
||||
if self.explorer.opts.ui.confirm.remove then
|
||||
local prompt_select = "Remove bookmarked ?"
|
||||
local prompt_input = prompt_select .. " y/N: "
|
||||
lib.prompt(prompt_input, prompt_select, { "", "y" }, { "No", "Yes" }, "nvimtree_bulk_delete", function(item_short)
|
||||
@@ -129,7 +125,7 @@ function Marks:bulk_trash()
|
||||
self:clear_reload()
|
||||
end
|
||||
|
||||
if self.config.ui.confirm.trash then
|
||||
if self.explorer.opts.ui.confirm.trash then
|
||||
local prompt_select = "Trash bookmarked ?"
|
||||
local prompt_input = prompt_select .. " y/N: "
|
||||
lib.prompt(prompt_input, prompt_select, { "", "y" }, { "No", "Yes" }, "nvimtree_bulk_trash", function(item_short)
|
||||
|
||||
Reference in New Issue
Block a user