List<XAttachDebugger> (@NotNull Project project) { Sdk selected = null; RunnerAndConfigurationSettings settings = RunManager.getInstance(project).getSelectedConfiguration(); if (settings != null) { RunConfiguration runConfiguration = settings.getConfiguration(); if (runConfiguration instanceof AbstractPythonRunConfiguration) { selected = ((AbstractPythonRunConfiguration<?>)runConfiguration).getSdk(); } } final Sdk selectedSdk = selected; // most recent python version goes first final List<XAttachDebugger> result = PythonSdkUtil.getAllLocalCPythons() .stream() .filter(sdk -> sdk != selectedSdk) .filter(sdk -> PySdkExtKt.getSdkSeemsValid(sdk)) .sorted(PreferredSdkComparator.INSTANCE) .map(PyLocalAttachDebugger::new) .collect(Collectors.toList()); if (selectedSdk != null) { result.add(0, new PyLocalAttachDebugger(selectedSdk)); } return result; }