src/JSUtils/ScopeManager.js
function addAllFilesAndSubdirectories(dir, doneCallback) {
            FileSystem.resolve(dir, function (err, directory) {
                function visitor(entry) {
                    if (entry.isFile) {
                        if (!isFileExcluded(entry)) { // ignore .dotfiles and non-.js files
                            addFilesToTern([entry.fullPath]);
                        }
                    } else {
                        return !isDirectoryExcluded(entry.fullPath) &&
                            entry.name.indexOf(".") !== 0 &&
                            !stopAddingFiles;
                    }
                }

                if (err) {
                    return;
                }

                if (dir === FileSystem.getDirectoryForPath(rootTernDir)) {
                    doneCallback();
                    return;
                }

                directory.visit(visitor, doneCallback);
            });
        }
function addAllFilesAndSubdirectories(dir, doneCallback) {
            FileSystem.resolve(dir, function (err, directory) {
                function visitor(entry) {
                    if (entry.isFile) {
                        if (!isFileExcluded(entry)) { // ignore .dotfiles and non-.js files
                            addFilesToTern([entry.fullPath]);
                        }
                    } else {
                        return !isDirectoryExcluded(entry.fullPath) &&
                            entry.name.indexOf(".") !== 0 &&
                            !stopAddingFiles;
                    }
                }

                if (err) {
                    return;
                }

                if (dir === FileSystem.getDirectoryForPath(rootTernDir)) {
                    doneCallback();
                    return;
                }

                directory.visit(visitor, doneCallback);
            });
        }
function addAllFilesAndSubdirectories ( dir , doneCallback ) { FileSystem . resolve ( dir , function ( err , directory ) { function visitor ( entry ) { if ( entry . isFile ) { if ( ! isFileExcluded ( entry ) ) { // ignore .dotfiles and non-.js files addFilesToTern ( [ entry . fullPath ] ) ; } } else { return ! isDirectoryExcluded ( entry . fullPath ) && entry . name . indexOf ( "." ) !== 0 && ! stopAddingFiles ; } } if ( err ) { return ; } if ( dir === FileSystem . getDirectoryForPath ( rootTernDir ) ) { doneCallback ( ) ; return ; } directory . visit ( visitor , doneCallback ) ; } ) ; }
Add the files in the directory and subdirectories of a given directory
to tern.

@param {string} dir - the root directory to add.
@param {function ()} doneCallback - called when all files have been
added to tern.
Add the files in the directory and subdirectories of a given directory to tern .