From 7bb530b3ee2108052cafb099d0f1f543c831a046 Mon Sep 17 00:00:00 2001 From: Alexander Koshevoy Date: Tue, 30 Sep 2025 12:52:26 +0200 Subject: [PATCH] Revert "[eel] Add EelProvider methods for environment-aware path handling (IJPL-178632)" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These helpers are redundant: an equality check already covers all use‑cases. Prefer direct comparisons to extra API surface, e.g.: ``` if (path.getEelDescriptor() == descriptor) { ... } ``` This reverts commit 7e752f7ea6461f7c49d3c71c6077cef7d0c4069f. GitOrigin-RevId: 07e54295aef350501bbb74aa4275ab9e1188c241 --- .../platform/eel/provider/EelProvider.kt | 26 ------------------- .../platform/ide/impl/wsl/WslEelProvider.kt | 17 ------------ .../execution/ijent/nio/IjentNioFsRegistry.kt | 7 ----- .../testFramework/junit5/eel/src/impl/util.kt | 11 +------- 4 files changed, 1 insertion(+), 60 deletions(-) diff --git a/platform/eel-provider/src/com/intellij/platform/eel/provider/EelProvider.kt b/platform/eel-provider/src/com/intellij/platform/eel/provider/EelProvider.kt index 186e5eb4c3e6..bc2b606aaa55 100644 --- a/platform/eel-provider/src/com/intellij/platform/eel/provider/EelProvider.kt +++ b/platform/eel-provider/src/com/intellij/platform/eel/provider/EelProvider.kt @@ -159,32 +159,6 @@ interface EelProvider { // TODO Better name. fun getEelMachineByInternalName(internalName: String): EelMachine? - - /** - * Returns `true` if one of [EelMachine] associated with this provider is responsible for the path. - */ - fun handlesPath(path: @MultiRoutingFileSystemPath String): Boolean - - /** - * Returns a lightweight predicate that checks whether a given path is handled by the specified machine. - * - * Contract and performance: - * - Must be cheap to obtain and safe to call repeatedly. - * - Must not allocate, start, or initialize the machine or any external resources. - * - Implementations should avoid I/O, process launches, or network calls; use only fast, local checks (e.g., prefix matching). - * - * Nullability: - * - Returns `null` if the machine is not associated with this provider. - * - * Semantics: - * - The predicate should return true for any path that belongs to, or could belong to, the machine managed by this provider. - * - Consistency expectation: within the same provider, for a given `path`, if the predicate returned by [getPathHandlerPredicate] - * returns `true` for that `path`, then [handlesPath] should also return `true` for the same `path`. - * - * @param machine the target environment/machine - * @return a predicate to test paths for this machine, or `null` if not applicable - */ - fun getPathHandlerPredicate(machine: EelMachine): ((path: @MultiRoutingFileSystemPath String) -> Boolean)? } @ApiStatus.Internal diff --git a/platform/platform-impl/eel/src/com/intellij/platform/ide/impl/wsl/WslEelProvider.kt b/platform/platform-impl/eel/src/com/intellij/platform/ide/impl/wsl/WslEelProvider.kt index 572cd6f0553e..0b5a6ee95111 100644 --- a/platform/platform-impl/eel/src/com/intellij/platform/ide/impl/wsl/WslEelProvider.kt +++ b/platform/platform-impl/eel/src/com/intellij/platform/ide/impl/wsl/WslEelProvider.kt @@ -195,23 +195,6 @@ class WslEelProvider : EelProvider { else null - override fun handlesPath(path: @MultiRoutingFileSystemPath String): Boolean { - if (!WslIjentAvailabilityService.getInstance().useIjentForWslNioFileSystem()) { - return false - } - - return WslPath.parseWindowsUncPath(path) != null - } - - override fun getPathHandlerPredicate(machine: EelMachine): ((path: @MultiRoutingFileSystemPath String) -> Boolean)? { - if (machine !is WslEelMachine) return null - if (!WslIjentAvailabilityService.getInstance().useIjentForWslNioFileSystem()) return null - return predicate@{ path -> - val windowsUncPath = WslPath.parseWindowsUncPath(path) ?: return@predicate false - windowsUncPath.distributionId == machine.distribution.id - } - } - override suspend fun tryInitialize(@MultiRoutingFileSystemPath path: String) { if (!WslIjentAvailabilityService.getInstance().useIjentForWslNioFileSystem()) { return diff --git a/platform/platform-impl/src/com/intellij/execution/ijent/nio/IjentNioFsRegistry.kt b/platform/platform-impl/src/com/intellij/execution/ijent/nio/IjentNioFsRegistry.kt index 9c5f230b9926..bc906881e517 100644 --- a/platform/platform-impl/src/com/intellij/execution/ijent/nio/IjentNioFsRegistry.kt +++ b/platform/platform-impl/src/com/intellij/execution/ijent/nio/IjentNioFsRegistry.kt @@ -100,13 +100,6 @@ fun CoroutineScope.registerIjentNioFs( override fun getEelMachineByInternalName(internalName: String): EelMachine? = if (internalName == ijent.descriptor.machine.name) ijent.descriptor.machine else null - - override fun handlesPath(path: String): Boolean = path.startsWith(root) - - override fun getPathHandlerPredicate(machine: EelMachine): ((path: @MultiRoutingFileSystemPath String) -> Boolean)? { - if (machine != ijent.descriptor.machine) return null - return { path -> path.startsWith(root) } - } }, disposable, ) diff --git a/platform/testFramework/junit5/eel/src/impl/util.kt b/platform/testFramework/junit5/eel/src/impl/util.kt index d2c83a0ebfe1..55af5baad095 100644 --- a/platform/testFramework/junit5/eel/src/impl/util.kt +++ b/platform/testFramework/junit5/eel/src/impl/util.kt @@ -59,10 +59,8 @@ internal fun eelInitializer(os: EelPlatform): TestFixtureInitializer Boolean)? { - if (machine != descriptor.machine) return null - return { path -> path.startsWith(fakeRootOsAgnostic) } - } }, disposable, )