public static JSNamedElementProxy resolve(final Project project, final ID<String, Void> index, final String lookupKey) {
JSNamedElementProxy result = null;
final JavaScriptIndex jsIndex = JavaScriptIndex.getInstance(project);
final GlobalSearchScope scope = GlobalSearchScope.allScope(project);
for (VirtualFile file : FileBasedIndex.getInstance().getContainingFiles(index, lookupKey, scope)) {
final JSIndexEntry entry = jsIndex.getEntryForFile(file, scope);
final JSNamedElementProxy resolve = entry != null ? entry.resolveAdditionalData(jsIndex, index.toString(), lookupKey) : null;
if (resolve != null) {
result = resolve;
if (result.canNavigate()) break;
}
}