platform/eel/docs/EelApi_LocalEelDescriptor.md
LocalEelDescriptor is a singleton that represents the environment where the IntelliJ IDE is installed — the machine where the IDE process runs.
While the Eel API provides a way to interact with various environments (like Docker containers or WSL distributions), LocalEelDescriptor specifically represents the native environment of the IDE itself.
Understanding the relationship between LocalEelDescriptor and LocalEelMachine is important:
LocalEelDescriptor:
EelDescriptor interfaceLocalEelMachine:
EelMachine interfaceThey are related: LocalEelDescriptor.machine === LocalEelMachine
LocalEelDescriptor serves as the default environment when no other environment is applicable. When a path doesn't match any known remote environment pattern, it's assumed to be a local path and associated with LocalEelDescriptor.
Examples:
Path.of("C:\\Users\\...") → LocalEelDescriptorPath.of("\\\\wsl$\\Ubuntu\\...") → WslEelDescriptorPath.of("/docker-<id>/...") → DockerEelDescriptorLocalEelDescriptor (fallback)Anti-pattern Warning: Checking for LocalEelDescriptor creates machine-dependent code and should be avoided in most cases.
// ANTI-PATTERN: Avoid this if possible
if (path.getEelDescriptor() == LocalEelDescriptor) {
...
} else {
...
}
// PREFERRED: Use EEL API uniformly
val eelApi = path.getEelDescriptor().toEelApi()
// ... use eelApi operations that work everywhere
The EEL API is designed so that code works uniformly across all environments without needing to distinguish between local and remote.
Checking for LocalEelDescriptor is justified only in these specific cases:
If you identify other legitimate use cases, please report them to the DevEnv team.
// Use localEel when you need the local API directly
val localApi: LocalEelApi = localEel
// For polymorphic code, use toEelApi()
fun doSomething(descriptor: EelDescriptor) {
val api = descriptor.toEelApi() // Works for any descriptor
}
To get platform information about the local machine where the IDE runs:
// Get platform information via localEel
when {
localEel.platform.isPosix -> println("IDE running on Unix-like OS")
localEel.platform.isWindows -> println("IDE running on Windows")
localEel.platform.isMac -> println("IDE running on macOS specifically")
}
// Get a human-readable name
println("Running on: ${LocalEelMachine.name}")
// Output: "Local: Windows 11" or "Local: macOS Sonoma"
Converting LocalEelDescriptor to an EelApi instance is instant and doesn't involve any I/O:
// Suspending version
val api: EelApi = LocalEelDescriptor.toEelApi()
// Blocking version (also instant for local)
val api: EelApi = LocalEelDescriptor.toEelApiBlocking()
// Or use the singleton directly
val api: LocalEelApi = localEel
All three return the same singleton instance: LocalEelDescriptor.toEelApi() === localEel
LocalEelDescriptorlocalEel directly: When you know you need the local API, use localEel instead of converting from descriptor