Skip to content

Commit

Permalink
Warn about invalid files not loaded on-refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Oct 18, 2023
1 parent 845be37 commit b6993a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/nerdtree/tree_dir_node.vim
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ function! s:TreeDirNode.refresh()
let files = self._glob('*', 1) + self._glob('.*', 0)
let newChildNodes = []
let invalidFilesFound = 0
let invalidFiles = []
for i in files
try
"create a new path and see if it exists in this nodes children
Expand All @@ -582,7 +583,8 @@ function! s:TreeDirNode.refresh()
call add(newChildNodes, newNode)
endif
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
let invalidFilesFound = 1
let invalidFilesFound += 1
let invalidFiles += [i]
endtry
endfor

Expand All @@ -591,7 +593,7 @@ function! s:TreeDirNode.refresh()
call self.sortChildren()

if invalidFilesFound
call nerdtree#echoWarning('some files could not be loaded into the NERD tree')
call nerdtree#echoWarning(invalidFilesFound . ' Invalid file(s): ' . join(invalidFiles, ', '))
endif
endif
endfunction
Expand Down

0 comments on commit b6993a7

Please sign in to comment.