@@ -805,8 +805,21 @@ define(function (require, exports, module) {
805805 } ) ;
806806 }
807807
808- // these folders are generally very large, and we don't scan them otherwise it might freeze the UI
809- const EXCLUDED_FOLDERS = [ 'node_modules' , 'bower_components' , '.git' , '.npm' , '.yarn' ] ;
808+ /**
809+ * This function is to determine whether we need to exclude a folder from the suggestions list
810+ * so we exclude all the folders that start with . 'dot' as this are generally irrelevant dirs
811+ * secondly, we also exclude large dirs like node modules as they might freeze the UI if we scan them
812+ * @param {String } folderName - the folder name to check if we need to exclude it or not
813+ * @returns {Boolean } - true if we should exclude otherwise false
814+ */
815+ function _isExcludedFolder ( folderName ) {
816+ if ( folderName . startsWith ( '.' ) ) { return true ; }
817+
818+ const UNNECESSARY_FOLDERS = [ 'node_modules' , 'bower_components' ] ;
819+ if ( UNNECESSARY_FOLDERS . includes ( folderName ) ) { return true ; }
820+
821+ return false ;
822+ }
810823
811824 /**
812825 * this function scans all the root directories
@@ -828,8 +841,7 @@ define(function (require, exports, module) {
828841 const directories = contents . filter ( entry => entry . isDirectory ) ;
829842
830843 directories . forEach ( dir => {
831- // ignore all the excluded folders
832- if ( EXCLUDED_FOLDERS . includes ( dir . name ) ) { return ; }
844+ if ( _isExcludedFolder ( dir . name ) ) { return ; }
833845 // add root folder name with trailing slash
834846 folderList . push ( dir . name + '/' ) ;
835847 } ) ;
@@ -859,10 +871,7 @@ define(function (require, exports, module) {
859871 const scanPromises = [ ] ;
860872
861873 directories . forEach ( dir => {
862- // if its an excluded folder we ignore it
863- if ( EXCLUDED_FOLDERS . includes ( dir . name ) ) {
864- return ;
865- }
874+ if ( _isExcludedFolder ( dir . name ) ) { return ; }
866875
867876 const dirRelativePath = relativePath ? `${ relativePath } ${ dir . name } /` : `${ dir . name } /` ;
868877 folderList . push ( dirRelativePath ) ;
0 commit comments