List<PyElement> (@NotNull Editor editor, @NotNull PyFile pyFile) { final SelectionModel selectionModel = editor.getSelectionModel(); final TextRange selectionRange = new TextRange(selectionModel.getSelectionStart(), selectionModel.getSelectionEnd()); final List<PyElement> members = PyMoveModuleMembersHelper.getTopLevelModuleMembers(pyFile); return ContainerUtil.filter(members, member -> { final PsiElement body = PyMoveModuleMembersHelper.expandNamedElementBody((PsiNamedElement)member); return body != null && selectionRange.contains(body.getTextRange()); }); }