(RIDER-106692) What's New: more logs by default

GitOrigin-RevId: 90d040a39090ec50e3a64c790d55400a305e826d
This commit is contained in:
Ivan Migalev
2024-06-06 16:33:43 +02:00
committed by intellij-monorepo-bot
parent 11b51897da
commit 493bcd4dd9
3 changed files with 12 additions and 5 deletions

View File

@@ -50,6 +50,7 @@ internal class WhatsNewAction : AnAction(), com.intellij.openapi.project.DumbAwa
val content: WhatsNewContent? = WhatsNewContent.getWhatsNewContent()
suspend fun openWhatsNew(project: Project) {
LOG.info("Open What's New page requested.")
val dataContext = LOG.runAndLogException { DataManager.getInstance().dataContextFromFocusAsync.await() }
openWhatsNewPage(project, dataContext)
}
@@ -72,6 +73,7 @@ internal class WhatsNewAction : AnAction(), com.intellij.openapi.project.DumbAwa
check(JBCefApp.isSupported()) { "JCEF is not supported on this system" }
val title = IdeBundle.message("update.whats.new", ApplicationNamesInfo.getInstance().fullProductName)
withContext(Dispatchers.EDT) {
LOG.info("Opening What's New in editor.")
openEditor(project, title, whatsNewContent.getRequest(dataContext))?.let {
project.serviceAsync<FileEditorManager>().addTopComponent(it, ReactionsPanel.createPanel(PLACE, reactionChecker))
WhatsNewCounterUsageCollector.openedPerformed(project, byClient)

View File

@@ -3,7 +3,6 @@ package com.intellij.platform.whatsNew
import com.intellij.ide.util.PropertiesComponent
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.diagnostic.trace
internal class WhatsNewContentVersionChecker {
companion object {
@@ -13,7 +12,7 @@ internal class WhatsNewContentVersionChecker {
fun isNeedToShowContent(whatsNewContent: WhatsNewContent): Boolean {
val savedVersionInfo = PropertiesComponent.getInstance().getValue(LAST_SHOWN_EAP_VERSION_PROP) ?: run {
LOG.trace("$LAST_SHOWN_EAP_VERSION_PROP is not defined. Will show What's New.")
LOG.info("$LAST_SHOWN_EAP_VERSION_PROP is not defined. Will show What's New.")
return true
}
val savedVersion = WhatsNewContent.ContentVersion.parse(savedVersionInfo) ?: run {
@@ -27,12 +26,12 @@ internal class WhatsNewContentVersionChecker {
}
val result = newVersion > savedVersion || (newVersion.releaseInfoEquals(savedVersion) && newVersion.hash != savedVersion.hash)
LOG.trace { "Comparing versions $newVersion > $savedVersion: $result." }
LOG.info("Comparing versions $newVersion > $savedVersion: $result.")
return result
}
fun saveLastShownContent(content: WhatsNewContent) {
LOG.trace { "EapWhatsNew version saved '${content.getVersion()}'" }
LOG.info("EapWhatsNew version saved '${content.getVersion()}'")
val version = content.getVersion() ?: run {
LOG.error("What's New content $content returned a null version.")
return

View File

@@ -3,6 +3,7 @@ package com.intellij.platform.whatsNew
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.ProjectActivity
import com.intellij.openapi.util.registry.Registry
@@ -17,10 +18,13 @@ internal class WhatsNewShowOnStartCheckService : ProjectActivity {
override suspend fun execute(project: Project) {
if (ourStarted.getAndSet(true)) return
if (application.isHeadlessEnvironment || application.isUnitTestMode || isPlaybackMode) return
logger.info("Checking whether to show the What's New page on startup.")
val content = WhatsNewContent.getWhatsNewContent()
logger.info("Got What's New content: $content")
if (content != null) {
if (isWhatsNewTestMode || WhatsNewContentVersionChecker.isNeedToShowContent(content)) {
if (isWhatsNewTestMode.also { logger.info("What's New test mode: $it") }
|| WhatsNewContentVersionChecker.isNeedToShowContent(content).also { logger.info("Should show What's New: $it") }) {
val whatsNewAction = service<ActionManager>().getAction("WhatsNewAction") as? WhatsNewAction
whatsNewAction?.openWhatsNew(project)
}
@@ -30,3 +34,5 @@ internal class WhatsNewShowOnStartCheckService : ProjectActivity {
internal val isWhatsNewTestMode: Boolean
get() = Registry.`is`("whats.new.test.mode")
private val logger = logger<WhatsNewShowOnStartCheckService>()