Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popup delay addition for code scan issues. #4436

Merged
merged 4 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.intellij.psi.PsiDocumentManager
import com.intellij.ui.JBColor
import com.intellij.ui.awt.RelativePoint
import com.intellij.ui.components.JBScrollPane
import com.intellij.util.TimeoutUtil.sleep
import icons.AwsIcons
import software.amazon.awssdk.services.codewhispererruntime.model.CodeWhispererRuntimeException
import software.aws.toolkits.core.utils.convertMarkdownToHTML
Expand All @@ -38,6 +39,7 @@ import software.aws.toolkits.jetbrains.services.codewhisperer.language.CodeWhisp
import software.aws.toolkits.jetbrains.services.codewhisperer.language.programmingLanguage
import software.aws.toolkits.jetbrains.services.codewhisperer.telemetry.CodeWhispererTelemetryService
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererColorUtil.getHexString
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.CODE_SCAN_ISSUE_POPUP_DELAY_IN_SECONDS
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.CODE_SCAN_ISSUE_TITLE_MAX_LENGTH
import software.aws.toolkits.jetbrains.services.codewhisperer.util.runIfIdcConnectionOrTelemetryEnabled
import software.aws.toolkits.jetbrains.utils.applyPatch
Expand Down Expand Up @@ -378,7 +380,10 @@ class CodeWhispererCodeScanEditorMouseMotionListener(private val project: Projec
// Show popup for only the first issue found.
// Only add popup if the issue is still valid. If the issue has gone stale or invalid because
// the user has made some edits, we don't need to show the popup for the stale or invalid issues.
if (!issuesInRange.first().isInvalid) showPopup(issuesInRange, e)
if (!issuesInRange.first().isInvalid) {
sleep(CODE_SCAN_ISSUE_POPUP_DELAY_IN_SECONDS)
showPopup(issuesInRange, e)
}
}

private data class ScanIssuePopupContext(val issue: CodeWhispererCodeScanIssue, val popup: JBPopup)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ object CodeWhispererConstants {
const val TOTAL_SECONDS_IN_MINUTE: Long = 60L
const val ACCOUNTLESS_START_URL = "accountless"
const val FEATURE_CONFIG_POLL_INTERVAL_IN_MS: Long = 30 * 60 * 1000L // 30 mins
const val CODE_SCAN_ISSUE_POPUP_DELAY_IN_SECONDS: Long = 1500 // 1.5 seconds
const val USING: String = "using"
const val GLOBAL_USING: String = "global using"
const val STATIC: String = "static"
Expand Down