String moduleName = linkMatcher.group(1);
PsiFile[] psiFiles = FilenameIndex.getFilesByName(
project, moduleName + ".erl", GlobalSearchScope.allScope(project));
for (PsiFile psiFile : psiFiles) {
if (psiFile instanceof ErlangFile) {
ErlangFile erlFile = (ErlangFile) psiFile;
if (linkMatcher.group(2) == null) {
return erlFile.getModule();
}
else {
String functionName = linkMatcher.group(3);
if (functionName.equals("type")) {
String typeName = linkMatcher.group(4);
return erlFile.getType(typeName);
}
else {
int arity = Integer.valueOf(linkMatcher.group(4));
return erlFile.getFunction(functionName, arity);
}
}
}
}
}