

def add_root(self, view, path):
    '\n        Adds `path` to the monitored roots if it is unknown.\n\n        If a `pubspec.yaml` is found in the path, its parent is monitored.\n        Otherwise the passed-in directory name is monitored.\n\n        @path\n          Can be a directory or a file path.\n        '
    if (not path):
        _logger.debug('not a valid path: %s', path)
        return
    new_root_path = find_pubspec_path(path)
    if (not new_root_path):
        new_root_path = os.path.dirname(path)
        _logger.debug('did not find pubspec.yaml in path: %s', path)
        _logger.debug('set root to: %s', new_root_path)
    with AnalysisServer._op_lock:
        if (new_root_path not in self.roots):
            _logger.debug('adding new root: %s', new_root_path)
            self.roots.append(new_root_path)
            self.send_set_roots(view, self.roots)
            return
    _logger.debug('root already known: %s', new_root_path)

dataset/ETHPy150Open guillermooo/dart-sublime-bundle/lib/analyzer/analyzer.py AnalysisServer.add_root/original