Ejemplo n.º 1
0
def tagCandidateFilterCheck(word, candidate):
    symbols = word.split("@")
    if len(symbols) == 1:
        return CommonUtil.fileMatch(symbols[0], candidate.path)
    elif len(symbols) == 2:
        passFlag = True
        if symbols[0] is not "":
            passFlag = CommonUtil.fileMatch(symbols[0], candidate.path)
        if passFlag and symbols[1] is not "":
            passFlag = CommonUtil.wordMatch(symbols[1], candidate.codeSnip)
        return passFlag
    return True
Ejemplo n.º 2
0
    def switchHeadAndImpl(self):
        '''
        switch between [.h|.hpp] with [.cpp|.m|.c|.cc]
        '''
        try:
            filename = os.path.basename(vim.current.buffer.name)
        except:
            return
        s = []
        extentions = [".cpp", ".c", ".cc", ".m"]
        if re.search("\.(h|hpp)$", filename):
            for ext in extentions:
                s.append(re.sub("\.(h|hpp)$", ext, filename))
        elif re.search("\.(c|cpp|cc|m)$", filename):
            s.append(re.sub("\.(c|cpp|cc)$", ".h", filename))
            s.append(re.sub("\.(c|cpp|cc)$", ".hpp", filename))

        candidates = getattr(self, "cachedCandidates", self.makeIndex())
        matchedCandidates = []
        for candidate in candidates:
            for pattern in s:
                if CommonUtil.fileMatch(pattern + "$", candidate.path):
                    matchedCandidates.append(candidate)
                    break
        if len(matchedCandidates) == 1:
            matchedCandidates[0].onAction("close")
        else:
            SearchBackend.showSearchResult(matchedCandidates)
Ejemplo n.º 3
0
    def search(self, symbol):
        candidates = getattr(self, "cachedCandidates", self.makeIndex())
        matchedCandidates = []
        for candidate in candidates:
                if CommonUtil.fileMatch(symbol, candidate.path):
                    matchedCandidates.append(candidate)

        if len(matchedCandidates) == 1:
            matchedCandidates[0].onAction("close")
        else:
            SearchBackend.showSearchResult(matchedCandidates)
Ejemplo n.º 4
0
def fileCandidateFilterCheck(word, candidate):
    return CommonUtil.fileMatch(word, candidate.path)
Ejemplo n.º 5
0
 def _candidateFilterCheck(self, word, candidate):
     return CommonUtil.wordMatch(word, candidate.symbol)