121121--- @private
122122--- @param path string
123123--- @param path_type string | nil filetype of path
124- --- @param bookmarks table<string , string | nil > path, filetype table of bookmarked files
124+ --- @param bookmarks table<string , Node > path to bookmarked Node
125125--- @return boolean
126126function Filters :bookmark (path , path_type , bookmarks )
127127 if not self .state .no_bookmark then
@@ -132,24 +132,26 @@ function Filters:bookmark(path, path_type, bookmarks)
132132 return true
133133 end
134134
135+ local DirectoryNode = require (" nvim-tree.node.directory" )
135136 local mark_parent = utils .path_add_trailing (path )
136- for mark , mark_type in pairs (bookmarks ) do
137- if type (mark_type ) == " table" and mark_type .type then
138- mark_type = mark_type .type
139- end
140- if path == mark then
137+
138+ for bookmark_path , bookmark_entry in pairs (bookmarks ) do
139+ if path == bookmark_path then
141140 return false
142141 end
143142
144143 if path_type == " directory" then
145144 -- check if path is mark's parent
146- if vim .fn .stridx (mark , mark_parent ) == 0 then
145+ if vim .fn .stridx (bookmark_path , mark_parent ) == 0 then
147146 return false
148147 end
149148 end
150- if mark_type == " directory" then
149+
150+ --- @type DirectoryNode ?
151+ local dir = bookmark_entry :as (DirectoryNode )
152+ if dir then
151153 -- check if mark is path's parent
152- local path_parent = utils .path_add_trailing (mark )
154+ local path_parent = utils .path_add_trailing (bookmark_path )
153155 if vim .fn .stridx (path , path_parent ) == 0 then
154156 return false
155157 end
0 commit comments