void FRiderLCModule::SetupLiveCodingBinds()

in src/cpp/RiderLink/Source/RiderLC/Private/RiderLC.cpp [20:53]


void FRiderLCModule::SetupLiveCodingBinds()
{
	IRiderLinkModule& RiderLinkModule = IRiderLinkModule::Get();
	RiderLinkModule.ViewModel(ModuleLifetimeDef.lifetime, [](const rd::Lifetime& Lifetime, JetBrains::EditorPlugin::RdEditorModel const& RdEditorModel)
	{
		RdEditorModel.get_triggerHotReload().advise(Lifetime, []
		{
			AsyncTask(ENamedThreads::GameThread, []
			{
#if WITH_LIVE_CODING
				ILiveCodingModule* LiveCoding = FModuleManager::GetModulePtr<ILiveCodingModule>(LIVE_CODING_MODULE_NAME);
				if (LiveCoding != nullptr && LiveCoding->IsEnabledByDefault())
				{
					LiveCoding->EnableForSession(true);
					if (LiveCoding->IsEnabledForSession())
					{
						LiveCoding->Compile();
					}
				}
				else
#endif
				{
#if WITH_HOT_RELOAD
					IHotReloadInterface* HotReload = FModuleManager::GetModulePtr<IHotReloadInterface>(HotReloadModule);
					if (HotReload != nullptr && !HotReload->IsCurrentlyCompiling())
					{
						HotReload->DoHotReloadFromEditor(EHotReloadFlags::None);
					}
#endif
				}
			});
		});
	});
}