예제 #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
예제 #2
0
파일: Locate.py 프로젝트: xieyu/vim-assist
    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)
예제 #3
0
파일: Locate.py 프로젝트: xieyu/vim-assist
    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)
예제 #4
0
def fileCandidateFilterCheck(word, candidate):
    return CommonUtil.fileMatch(word, candidate.path)
예제 #5
0
파일: Ctags.py 프로젝트: xieyu/vim-assist
 def _candidateFilterCheck(self, word, candidate):
     return CommonUtil.wordMatch(word, candidate.symbol)