generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce an extension for hot reload
- Loading branch information
Showing
2 changed files
with
52 additions
and
46 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/main/kotlin/me/rafaelldi/aspire/sessionHost/SessionHotReloadConfigurationExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package me.rafaelldi.aspire.sessionHost | ||
|
||
import com.jetbrains.rd.util.lifetime.Lifetime | ||
import com.jetbrains.rider.run.configurations.HotReloadEnvironmentBuilder | ||
import com.jetbrains.rider.run.configurations.RiderHotReloadRunConfigurationExtensionBase | ||
import com.jetbrains.rider.run.configurations.RuntimeHotReloadRunConfigurationInfo | ||
import com.jetbrains.rider.run.configurations.launchSettings.LaunchSettingsJson | ||
import com.jetbrains.rider.runtime.DotNetExecutable | ||
|
||
class SessionHotReloadConfigurationExtension : RiderHotReloadRunConfigurationExtensionBase() { | ||
suspend fun canExecute( | ||
lifetime: Lifetime, | ||
hotReloadRunInfo: RuntimeHotReloadRunConfigurationInfo, | ||
profile: LaunchSettingsJson.Profile? | ||
): Boolean { | ||
if (profile?.hotReloadEnabled == false) return false | ||
|
||
return isRuntimeHotReloadAvailable(lifetime, hotReloadRunInfo) | ||
} | ||
|
||
fun execute(executable: DotNetExecutable): DotNetExecutable { | ||
val pipeName = getPipeName() | ||
val hotReloadEnvs = HotReloadEnvironmentBuilder() | ||
.setNamedPipe(pipeName) | ||
.addDeltaApplier() | ||
.build() | ||
|
||
val envs = mergeEnvs(executable.environmentVariables, hotReloadEnvs) | ||
|
||
return executable.copy(environmentVariables = envs) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters