PsiFile (PsiDirectory dir, String referencedName, boolean withoutStubs) { PsiFile file = null; if (!withoutStubs) { final var stub = dir.findFile(referencedName + PyNames.DOT_PYI); if (!PyiStubSuppressor.isIgnoredStub(stub)) { file = stub; } } if (file == null) { file = dir.findFile(referencedName + PyNames.DOT_PY); } // TODO: in case of real users need make an extension point out of the following code // if (file == null) { // final List<FileNameMatcher> associations = FileTypeManager.getInstance().getAssociations(PythonFileType.INSTANCE); // for (FileNameMatcher association : associations) { // if (association instanceof ExtensionFileNameMatcher) { // file = dir.findFile(referencedName + "." + ((ExtensionFileNameMatcher)association).getExtension()); // if (file != null) break; // } // } //} if (file != null && FileUtilRt.getNameWithoutExtension(file.getName()).equals(referencedName)) { return file; } return null; }