This commit is contained in:
parent
ce09bfb95f
commit
f5f6789299
@ -11,11 +11,11 @@ local git = require("nvim-tree.git")
|
|||||||
---@field fs_stat uv.fs_stat.result?
|
---@field fs_stat uv.fs_stat.result?
|
||||||
---@field git_status GitStatus?
|
---@field git_status GitStatus?
|
||||||
---@field hidden boolean
|
---@field hidden boolean
|
||||||
---@field is_dot boolean
|
|
||||||
---@field name string
|
---@field name string
|
||||||
---@field parent Node?
|
---@field parent Node?
|
||||||
---@field watcher Watcher?
|
---@field watcher Watcher?
|
||||||
---@field diag_status DiagStatus?
|
---@field diag_status DiagStatus?
|
||||||
|
---@field is_dot boolean cached is_dotfile
|
||||||
local BaseNode = {}
|
local BaseNode = {}
|
||||||
|
|
||||||
---@alias Node RootNode|BaseNode|DirectoryNode|FileNode|LinkNode
|
---@alias Node RootNode|BaseNode|DirectoryNode|FileNode|LinkNode
|
||||||
@ -157,11 +157,12 @@ function BaseNode:is_git_ignored()
|
|||||||
return self.git_status ~= nil and self.git_status.file == "!!"
|
return self.git_status ~= nil and self.git_status.file == "!!"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Node or one of its parents begins with a dot
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function BaseNode:is_dotfile()
|
function BaseNode:is_dotfile()
|
||||||
if
|
if
|
||||||
self.is_dot --
|
self.is_dot
|
||||||
or (self.name and (self.name:sub(1, 1) == ".")) --
|
or (self.name and (self.name:sub(1, 1) == "."))
|
||||||
or (self.parent and self.parent:is_dotfile())
|
or (self.parent and self.parent:is_dotfile())
|
||||||
then
|
then
|
||||||
self.is_dot = true
|
self.is_dot = true
|
||||||
|
|||||||
@ -17,4 +17,10 @@ function RootNode:create(explorer, absolute_path, name, fs_stat)
|
|||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Root is never a dotfile
|
||||||
|
---@return boolean
|
||||||
|
function RootNode:is_dotfile()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
return RootNode
|
return RootNode
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user