コード例 #1
0
ファイル: c.py プロジェクト: joehewitt/devon
 def jumpText(self, sourcePath, sourceText, caretOffset):
     sourceDirPath = os.path.dirname(sourcePath)
 
     # Check if the text is a C #include and try to lookup the full path of the file
     for (target, relist) in jump.getPatternMatch(sourceText, [reCIncludes, reStrings]):
         fullPath = jump.expandIncludedPath(self.project, sourceDirPath, target)
         if fullPath:
             return fullPath
 
     # Check if the text is a substring of any source file in the project
     if reFileNameCandidate.match(sourceText):
         fullPath = jump.expandProjectPath(self.project, sourceText)
         if fullPath:
             return fullPath
コード例 #2
0
ファイル: python.py プロジェクト: joehewitt/devon
    def jumpText(self, sourcePath, sourceText, caretOffset):
        sourceDirPath = os.path.dirname(sourcePath)

        for target, relist in jump.getPatternMatch(sourceText, [rePythonImports, reStrings]):
            if relist == rePythonImports:
                moduleName = jump.getFocusedSymbol(sourceText, caretOffset, "[\.\w]")
                module = __import__(moduleName)
                if module and hasattr(module, "__file__"):
                    modulePath = module.__file__
                    if modulePath[-3:] == "pyc":
                        modulePath = modulePath[:-1]

                    return modulePath

                break

            elif relist == reStrings:
                return jump.expandIncludedPath(self.project, sourceDirPath, target)