void (@NotNull Sdk sdk, @NotNull List<String> paths, @Nullable Project project) { final var moduleRoots = getModuleRoots(project); final var excludedPaths = getExcludedPaths(sdk); final var sdkRoots = splitIntoLibraryAndSourceRoots(sdk, paths, moduleRoots, excludedPaths, it -> sdkPathToRoot(sdk, it)); final var userAddedRoots = splitIntoLibraryAndSourceRoots(sdk, getUserAddedPaths(sdk), moduleRoots, excludedPaths, Function.identity()); final boolean forceCommit = ensureBinarySkeletonsDirectoryExists(sdk); final List<VirtualFile> localSdkPaths = buildSdkPaths(sdk, sdkRoots.first, userAddedRoots.first); commitSdkPathsIfChanged(sdk, localSdkPaths, forceCommit); final var pathsToTransfer = new HashSet<VirtualFile>(); pathsToTransfer.addAll(sdkRoots.second); pathsToTransfer.addAll(userAddedRoots.second); // Presumably source and content roots that were configured manually by user, not set up automatically as "transferred" HashSet<VirtualFile> nonTransferredModuleRoots = new HashSet<>(moduleRoots); nonTransferredModuleRoots.removeAll(PyTransferredSdkRootsKt.getPathsToTransfer(sdk)); pathsToTransfer.removeAll(nonTransferredModuleRoots); /* Don't run actions related to transferred roots on editable sdks since they can share data with original ones. PyTransferredSdkRootsKt#transferRoots and PyTransferredSdkRootsKt#removeTransferredRoots skip sdks that are not equal to module one (editable as well). That's why roots changes were not applied but paths to transfer were successfully set. When current method was executed for original sdk, roots changes were not applied since there were no changes in paths to transfer (they were shared with editable copy). */ if (ArrayUtil.contains(sdk, ProjectJdkTable.getInstance().getAllJdks()) && !pathsToTransfer.equals(PyTransferredSdkRootsKt.getPathsToTransfer(sdk))) { if (project != null) { PyTransferredSdkRootsKt.removeTransferredRootsFromModulesWithSdk(project, sdk); } PyTransferredSdkRootsKt.setPathsToTransfer(sdk, pathsToTransfer); if (project != null) { PyTransferredSdkRootsKt.transferRootsToModulesWithSdk(project, sdk); } } }