Check if references are in this file only
If yes then select all references
5057
function handleFindRefs (refsResp) {
            if (!refsResp || !refsResp.references || !refsResp.references.refs) {
                return;
            }

            var inlineWidget = EditorManager.getFocusedInlineWidget(),
                editor = EditorManager.getActiveEditor(),
                refs = refsResp.references.refs,
                type = refsResp.references.type;

            //In case of inline widget if some references are outside widget's text range then don't allow for rename
            if (inlineWidget) {
                var isInTextRange  = !refs.find(function(item) {
                    return (item.start.line < inlineWidget._startLine || item.end.line > inlineWidget._endLine);
                });
                
                if (!isInTextRange) {
                    editor.displayErrorMessageAtCursor(Strings.ERROR_RENAME_QUICKEDIT);
                    return;
                }
            }

            var currentPosition = editor.posFromIndex(refsResp.offset),
                refsArray = refs;
            if (type !== "local") {
                refsArray = refs.filter(function (element) {
                    return isInSameFile(element, refsResp);
                });
            }

            // Finding the Primary Reference in Array
            var primaryRef = refsArray.find(function (element) {
                return ((element.start.line === currentPosition.line || element.end.line === currentPosition.line)
                        && currentPosition.ch <= element.end.ch && currentPosition.ch >= element.start.ch);
            });
            // Setting the primary flag of Primary Refence to true
            primaryRef.primary = true;

            editor.setSelections(refsArray);
        }
123138
def _references(self, i, sequence=False):
        """"""

        c = next(i)
        if c == '\\':
            # \\
            if sequence and self.bslash_abort:
                raise PathNameException
        elif c == '/':
            # \/
            if sequence and self.pathname:
                raise PathNameException
            elif self.pathname:
                i.rewind(1)
        else:
            # \a, \b, \c, etc.
            pass
23673
def check_all(self, expected=None, line_offset=0):
        """"""
        self.report.init_file(self.filename, self.lines, expected, line_offset)
        self.total_lines = len(self.lines)
        if self._ast_checks:
            self.check_ast()
        self.line_number = 0
        self.indent_char = None
        self.indent_level = self.previous_indent_level = 0
        self.previous_logical = ''
        self.previous_unindented_logical_line = ''
        self.tokens = []
        self.blank_lines = self.blank_before = 0
        parens = 0
        for token in self.generate_tokens():
            self.tokens.append(token)
            token_type, text = token[0:2]
            if self.verbose >= 3:
                if token[2][0] == token[3][0]:
                    pos = '[%s:%s]' % (token[2][1] or '', token[3][1])
                else:
                    pos = 'l.%s' % token[3][0]
                print('l.%s\t%s\t%s\t%r' %
                      (token[2][0], pos, tokenize.tok_name[token[0]], text))
            if token_type == tokenize.OP:
                if text in '([{':
                    parens += 1
                elif text in '}])':
                    parens -= 1
            elif not parens:
                if token_type in NEWLINE:
                    if token_type == tokenize.NEWLINE:
                        self.check_logical()
                        self.blank_before = 0
                    elif len(self.tokens) == 1:
                        # The physical line contains only this token.
                        self.blank_lines += 1
                        del self.tokens[0]
                    else:
                        self.check_logical()
                elif COMMENT_WITH_NL and token_type == tokenize.COMMENT:
                    if len(self.tokens) == 1:
                        # The comment also ends a physical line
                        token = list(token)
                        token[1] = text.rstrip('\r\n')
                        token[3] = (token[2][0], token[2][1] + len(token[1]))
                        self.tokens = [tuple(token)]
                        self.check_logical()
        if self.tokens:
            self.check_physical(self.lines[-1])
            self.check_logical()
        return self.report.get_file_results()
51060
private static boolean isIndexable(String filename, List<String> includes, List<String> excludes) {
        boolean excluded = isExcluded(filename, excludes);
        if (excluded) return false;

        return isIncluded(filename, includes);
    }
105186
def rebuild_references(self, src, path, reject=None):
        """"""
        if reject is None:
            reject = set()
        reject.add(path)

        try:
            filename = os.path.join(src, path)
            mtime = os.path.getmtime(filename)
            contents = open(filename)
        except EnvironmentError:
            raise ValueError("Unable to open '{0}'".format(path))

        if \
                path in self.parents and \
                self.parents[path].updated == mtime:
            # cache hit; no need to update
            return

        # drop existing references
        if path in self.parents:
            self.deleted(src, path)

        # build a list of parents
        parents = TimedSet(mtime)
        current = os.path.dirname(path)

        for line in contents:
            match = self.line_regex.search(line)
            if match:
                parent = match.group(1)
                relative = os.path.normpath(os.path.join(current, parent))
                if relative.startswith(".."):
                    raise ValueError("Parent reference '{0}' outside of "
                                     "watched folder in '{1}'".format(parent,
                                                                      path))
                parent = os.path.normcase(relative)
                if parent in reject:
                    raise ValueError("Circular reference to '{0}' "
                                     "detected in '{1}'".format(parent,
                                                                path))
                parents.add(parent)

        for parent in parents:
            # recursively build references for all parents; this will
            # usually be a cache hit and no-op
            self.rebuild_references(src, parent, reject)

        self.parents[path] = parents
        for parent in parents:
            # add this node to each of its parents' children
            if parent not in self.children:
                self.children[parent] = set()
            self.children[parent].add(path)
762503
public boolean addReference(String reference) {
    if (currentInfo.documentReference(reference)) {
      populated = true;
      return true;
    } else {
      return false;
    }
  }
729098
private boolean fileIncludesLine(File file, String matches) throws IOException {
        for (String line: Files.readLines(file)) {
            String trimmed = line.trim();
            if (trimmed.equals(matches)) {
                return true;
            }
        }
        return false;
    }
220792
public function hasReference( $reference, &$referenceDetail = null )
    {

        $referenceDetail = null;

        foreach( $this->__get('references') as $name => $detail ) {

            if( $name == $reference or $detail[0] == $reference ) {
                $referenceDetail = $detail;
                return $name;
            }

        }

        return null;

    }
180658
def excluded?(filename)
      exclude.each do |f|
        f += '**/*' if f.end_with? '/'
        return true if File.fnmatch(f, filename, File::FNM_EXTGLOB | File::FNM_PATHNAME)
      end
      false
    end
1107164
function findReference(scope, node) {
    const references = scope.references.filter(reference => reference.identifier.range[0] === node.range[0] &&
            reference.identifier.range[1] === node.range[1]);

    if (references.length === 1) {
        return references[0];
    }
    return null;
}
965771
private void categorizeReferenceFile(final Reference file) {
        // avoid files referred by coderef being added into wait list
        if (listFilter.getCoderefTargets().contains(file.filename)) {
            return;
        }
        if (isFormatDita(file.format) && listFilter.isDitaTopic() &&
                !job.crawlTopics() &&
                !listFilter.getConrefTargets().contains(file.filename)) {
            return;  // Do not process topics linked from within topics
        } else if ((isFormatDita(file.format) || ATTR_FORMAT_VALUE_DITAMAP.equals(file.format))) {
            addToWaitList(file);
        } else if (ATTR_FORMAT_VALUE_IMAGE.equals(file.format)) {
            formatSet.add(file);
            if (!exists(file.filename)) {
                logger.warn(MessageUtils.getMessage("DOTX008E", file.filename.toString()).toString());
            }
        } else if (ATTR_FORMAT_VALUE_DITAVAL.equals(file.format)) {
            formatSet.add(file);
        } else {
            htmlSet.put(file.format, file.filename);
        }
    }
458718
def _get_exclude_samples(in_file, to_exclude):
    
    include, exclude = [], []
    to_exclude = set(to_exclude)
    for s in get_samples(in_file):
        if s in to_exclude:
            exclude.append(s)
        else:
            include.append(s)
    return include, exclude
979505
def compare(all_dict, others, names, module_name):
    """"""
    only_all = set()
    for name in all_dict:
        if name not in names:
            only_all.add(name)

    only_ref = set()
    missing = set()
    for name in names:
        if name not in all_dict:
            for pat in REFGUIDE_ALL_SKIPLIST:
                if re.match(pat, module_name + '.' + name):
                    if name not in others:
                        missing.add(name)
                    break
            else:
                only_ref.add(name)

    return only_all, only_ref, missing
1164071
def _check_and_handle_includes(self, from_file):
        
        logger.debug("Check/handle includes from %s", from_file)
        try:
            paths = self._parser.get("INCLUDE", "paths")
        except (config_parser.NoSectionError,
                config_parser.NoOptionError) as exc:
            logger.debug("_check_and_handle_includes: EXCEPTION: %s", exc)
            return
        paths_lines = [p.strip() for p in paths.split("\n")]
        logger.debug("paths = %s (wanted just once; CLEARING)", paths_lines)
        self._parser.remove_option("INCLUDE", "paths")
        for f in paths_lines:
            abspath = (f if os.path.isabs(f) else
                       os.path.abspath(
                           os.path.join(os.path.dirname(from_file), f)))
            use_path = os.path.normpath(abspath)
            if use_path in self._parsed_files:
                raise RecursionInConfigFile("In %s: %s already read",
                                            from_file, use_path)
            self._parsed_files.append(use_path)
            self._handle_rc_file(use_path)
155922
def select(self, Class, set=None, recursive=True,  ignore=True, node=None):
        """"""
        if self.include:
            return self.subdoc.data[0].select(Class,set,recursive, ignore, node) #pass it on to the text node of the subdoc
        else:
            return iter([])
1275124
def _compile_references(self, url, tree):
        '''
        
        '''
        references = []
        for ref in tree.findall('.//{%s}catalogRef' % INV_NS):
            # Check skips
            title = ref.get("{%s}title" % XLINK_NS)
            if any([x.match(title) for x in self.skip]):
                logger.info("Skipping catalogRef based on 'skips'.  Title: %s" % title)
                continue
            references.append(construct_url(url, ref.get("{%s}href" % XLINK_NS)))
        return references
187185
private boolean selectACollection()
    {
        if (!cfm.comparator.hasCollections())
            return false;

        for (ColumnDefinition def : selection.getColumns())
        {
            if (def.type.isCollection() && def.type.isMultiCell())
                return true;
        }

        return false;
    }