mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
Warn about invalid files not loaded on-refresh
This commit is contained in:
@@ -566,6 +566,7 @@ function! s:TreeDirNode.refresh()
|
|||||||
let files = self._glob('*', 1) + self._glob('.*', 0)
|
let files = self._glob('*', 1) + self._glob('.*', 0)
|
||||||
let newChildNodes = []
|
let newChildNodes = []
|
||||||
let invalidFilesFound = 0
|
let invalidFilesFound = 0
|
||||||
|
let invalidFiles = []
|
||||||
for i in files
|
for i in files
|
||||||
try
|
try
|
||||||
"create a new path and see if it exists in this nodes children
|
"create a new path and see if it exists in this nodes children
|
||||||
@@ -582,7 +583,8 @@ function! s:TreeDirNode.refresh()
|
|||||||
call add(newChildNodes, newNode)
|
call add(newChildNodes, newNode)
|
||||||
endif
|
endif
|
||||||
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
||||||
let invalidFilesFound = 1
|
let invalidFilesFound += 1
|
||||||
|
let invalidFiles += [i]
|
||||||
endtry
|
endtry
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@@ -591,7 +593,7 @@ function! s:TreeDirNode.refresh()
|
|||||||
call self.sortChildren()
|
call self.sortChildren()
|
||||||
|
|
||||||
if invalidFilesFound
|
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
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user