diff --git a/.idea/modules.xml b/.idea/modules.xml
index c3829ed1b14a..fb9ae0741a01 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -633,6 +633,7 @@
+
diff --git a/platform/eel/intellij.platform.eel.iml b/platform/eel/intellij.platform.eel.iml
index 3a15dc6dd32a..90909950ef17 100644
--- a/platform/eel/intellij.platform.eel.iml
+++ b/platform/eel/intellij.platform.eel.iml
@@ -10,6 +10,5 @@
-
\ No newline at end of file
diff --git a/platform/eel/src/com/intellij/platform/eel/EelFsApi.kt b/platform/eel/src/com/intellij/platform/eel/EelFsApi.kt
new file mode 100644
index 000000000000..c252b7c5f621
--- /dev/null
+++ b/platform/eel/src/com/intellij/platform/eel/EelFsApi.kt
@@ -0,0 +1,13 @@
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.platform.eel
+
+import java.nio.file.Path
+
+interface EelFsApi {
+ fun getOriginalPath(path: Path): EelPath.Absolute
+}
+
+sealed interface EelPath {
+ data class Relative(val path: String) : EelPath
+ data class Absolute(val path: String) : EelPath
+}
\ No newline at end of file
diff --git a/platform/eel/src/com/intellij/platform/eel/EelTunnelsApi.kt b/platform/eel/src/com/intellij/platform/eel/EelTunnelsApi.kt
index 66b24fdcf247..9480fe26527c 100644
--- a/platform/eel/src/com/intellij/platform/eel/EelTunnelsApi.kt
+++ b/platform/eel/src/com/intellij/platform/eel/EelTunnelsApi.kt
@@ -1,7 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.eel
-import com.intellij.openapi.util.NlsSafe
import com.intellij.platform.eel.EelTunnelsApi.Connection
import com.intellij.platform.eel.impl.IpProtocolPreferenceImpl
import kotlinx.coroutines.CoroutineScope
@@ -393,7 +392,7 @@ sealed interface EelNetworkResult {
* An error that can happen during the creation of a connection to a remote server
*/
interface EelConnectionError : EelNetworkError {
- val message: @NlsSafe String
+ val message: String
/**
* Returned when the remote host cannot create an object of a socket.
diff --git a/platform/eelProvider/api-dump.txt b/platform/eelProvider/api-dump.txt
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/platform/eelProvider/intellij.platform.eel.provider.iml b/platform/eelProvider/intellij.platform.eel.provider.iml
new file mode 100644
index 000000000000..66e61dd8f53b
--- /dev/null
+++ b/platform/eelProvider/intellij.platform.eel.provider.iml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/platform/eelProvider/src/com/intellij/platform/eel/provider/EelProvider.kt b/platform/eelProvider/src/com/intellij/platform/eel/provider/EelProvider.kt
new file mode 100644
index 000000000000..d7d25055a3cb
--- /dev/null
+++ b/platform/eelProvider/src/com/intellij/platform/eel/provider/EelProvider.kt
@@ -0,0 +1,20 @@
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package com.intellij.platform.eel.provider
+
+import com.intellij.openapi.extensions.ExtensionPointName
+import com.intellij.platform.eel.EelApi
+import org.jetbrains.annotations.ApiStatus
+import java.nio.file.Path
+import kotlin.collections.firstNotNullOfOrNull
+
+suspend fun Path.getEelApi(): EelApi =
+ EP_NAME.extensionList.firstNotNullOfOrNull { it.getEelApi(this) } ?: LocalEelApi()
+
+@ApiStatus.Internal
+interface EelProvider {
+ suspend fun getEelApi(path: Path): EelApi?
+}
+
+private val EP_NAME = ExtensionPointName("com.intellij.eelProvider")
+
+fun LocalEelApi(): EelApi = TODO()
\ No newline at end of file
diff --git a/platform/eelProvider/src/com/intellij/platform/eel/provider/package-info.java b/platform/eelProvider/src/com/intellij/platform/eel/provider/package-info.java
new file mode 100644
index 000000000000..95be88dc28b0
--- /dev/null
+++ b/platform/eelProvider/src/com/intellij/platform/eel/provider/package-info.java
@@ -0,0 +1,8 @@
+// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+/**
+ * EEL API provider
+ */
+@ApiStatus.Internal
+package com.intellij.platform.eel.provider;
+
+import org.jetbrains.annotations.ApiStatus;
\ No newline at end of file
diff --git a/platform/platform-impl/intellij.platform.ide.impl.iml b/platform/platform-impl/intellij.platform.ide.impl.iml
index 4933354b3208..1fd8654f6aca 100644
--- a/platform/platform-impl/intellij.platform.ide.impl.iml
+++ b/platform/platform-impl/intellij.platform.ide.impl.iml
@@ -145,5 +145,6 @@
+
\ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/execution/wsl/ijent/nio/toggle/IjentNioFsStrategy.kt b/platform/platform-impl/src/com/intellij/execution/wsl/ijent/nio/toggle/IjentNioFsStrategy.kt
index a355e0066d02..b026131eef0b 100644
--- a/platform/platform-impl/src/com/intellij/execution/wsl/ijent/nio/toggle/IjentNioFsStrategy.kt
+++ b/platform/platform-impl/src/com/intellij/execution/wsl/ijent/nio/toggle/IjentNioFsStrategy.kt
@@ -6,12 +6,16 @@ import com.intellij.execution.wsl.WslDistributionManager
import com.intellij.execution.wsl.WslIjentManager
import com.intellij.execution.wsl.ijent.nio.IjentWslNioFileSystem
import com.intellij.execution.wsl.ijent.nio.IjentWslNioFileSystemProvider
+import com.intellij.openapi.components.serviceAsync
import com.intellij.openapi.diagnostic.debug
import com.intellij.openapi.diagnostic.logger
import com.intellij.platform.core.nio.fs.MultiRoutingFileSystemProvider
+import com.intellij.platform.eel.EelApi
+import com.intellij.platform.eel.provider.EelProvider
import com.intellij.platform.ijent.community.impl.IjentFailSafeFileSystemPosixApi
import com.intellij.platform.ijent.community.impl.nio.IjentNioFileSystemProvider
import com.intellij.platform.ijent.community.impl.nio.telemetry.TracingFileSystemProvider
+import com.intellij.util.containers.ContainerUtil
import com.intellij.util.containers.forEachGuaranteed
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.coroutineScope
@@ -22,9 +26,11 @@ import org.jetbrains.annotations.VisibleForTesting
import java.net.URI
import java.nio.file.FileSystem
import java.nio.file.FileSystemAlreadyExistsException
+import java.nio.file.Path
import java.nio.file.spi.FileSystemProvider
import java.util.concurrent.ConcurrentHashMap
import java.util.function.BiConsumer
+import kotlin.io.path.isSameFileAs
@ApiStatus.Internal
@VisibleForTesting
@@ -33,10 +39,25 @@ class IjentWslNioFsToggleStrategy(
private val coroutineScope: CoroutineScope,
) {
private val ownFileSystems = OwnFileSystems(multiRoutingFileSystemProvider)
+ private val enabledInDistros: MutableSet = ContainerUtil.newConcurrentSet()
init {
coroutineScope.coroutineContext.job.invokeOnCompletion {
unregisterAll()
+ enabledInDistros.clear()
+ }
+ }
+
+ // TODO Move to ijent.impl?
+ internal class WslEelProvider : EelProvider {
+ override suspend fun getEelApi(path: Path): EelApi? {
+ val service = serviceAsync()
+ for (distro in service.enabledInDistros) {
+ if (distro.uncRootPath.isSameFileAs(path.root)) {
+ return WslIjentManager.getInstance().getIjentApi(distro, null, rootUser = false)
+ }
+ }
+ return null
}
}
@@ -69,10 +90,12 @@ class IjentWslNioFsToggleStrategy(
}
private suspend fun handleWslDistributionAddition(distro: WSLDistribution) {
+ enabledInDistros += distro
switchToIjentFs(distro)
}
private fun handleWslDistributionDeletion(distro: WSLDistribution) {
+ enabledInDistros -= distro
ownFileSystems.compute(distro) { _, ownFs, actualFs ->
if (ownFs == actualFs) {
LOG.info("Unregistering a custom filesystem $actualFs from a removed WSL distribution $distro")
diff --git a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
index b3ef2eac5bb2..1917797270ec 100644
--- a/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
+++ b/platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml
@@ -19,6 +19,8 @@
+
+
diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml
index fa3c7cf35678..1d6368d1339d 100644
--- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml
+++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml
@@ -130,6 +130,8 @@
+
+
diff --git a/platform/platform-tests/intellij.platform.tests.iml b/platform/platform-tests/intellij.platform.tests.iml
index 5839441e0483..4b46637f06fe 100644
--- a/platform/platform-tests/intellij.platform.tests.iml
+++ b/platform/platform-tests/intellij.platform.tests.iml
@@ -102,5 +102,6 @@
+
\ No newline at end of file