-
Notifications
You must be signed in to change notification settings - Fork 23
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
Expose Restart Cody
action
#1965
Merged
mkondratek
merged 9 commits into
pkukielka/improve-integration-tests
from
mkondratek/restart-cody
Aug 5, 2024
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c708c3a
Do not error on startAgent timeout
mkondratek 0bcc680
Add timeout notification with the restart action
mkondratek cab3fd7
Do not try to shut down the exceptionally completed agent
mkondratek 032129b
Add the restart action to the status widget group
mkondratek 329e70f
Fixes
mkondratek 677f70d
Add `secondsTimeout` param to `startAgent`
mkondratek 630a4a7
Make sure the notification balloon is displayed only once at the time
mkondratek 1d1465e
Fixes
mkondratek 10028ab
Fixes
mkondratek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
src/main/kotlin/com/sourcegraph/cody/agent/CodyConnectionTimeoutExceptionNotification.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,23 @@ | ||
package com.sourcegraph.cody.agent | ||
|
||
import com.intellij.notification.Notification | ||
import com.intellij.notification.NotificationType | ||
import com.intellij.notification.impl.NotificationFullContent | ||
import com.sourcegraph.Icons | ||
import com.sourcegraph.cody.agent.action.CodyAgentRestartAction | ||
import com.sourcegraph.common.CodyBundle | ||
import com.sourcegraph.common.NotificationGroups | ||
|
||
class CodyConnectionTimeoutExceptionNotification : | ||
Notification( | ||
NotificationGroups.SOURCEGRAPH_ERRORS, | ||
CodyBundle.getString("notifications.cody-connection-timeout.title"), | ||
CodyBundle.getString("notifications.cody-connection-timeout.detail"), | ||
NotificationType.WARNING), | ||
NotificationFullContent { | ||
|
||
init { | ||
icon = Icons.CodyLogoSlash | ||
addAction(CodyAgentRestartAction()) | ||
} | ||
} |
11 changes: 9 additions & 2 deletions
11
src/main/kotlin/com/sourcegraph/cody/agent/action/CodyAgentRestartAction.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 |
---|---|---|
@@ -1,11 +1,18 @@ | ||
package com.sourcegraph.cody.agent.action | ||
|
||
import com.intellij.notification.NotificationsManager | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.sourcegraph.cody.agent.CodyAgentService | ||
import com.sourcegraph.cody.agent.CodyConnectionTimeoutExceptionNotification | ||
import com.sourcegraph.common.ui.DumbAwareEDTAction | ||
|
||
class CodyAgentRestartAction : DumbAwareEDTAction("Restart Cody Agent") { | ||
class CodyAgentRestartAction : DumbAwareEDTAction("Restart Cody") { | ||
override fun actionPerformed(event: AnActionEvent) { | ||
event.project?.let { CodyAgentService.getInstance(it).restartAgent(it) } | ||
event.project?.let { project -> | ||
CodyAgentService.getInstance(project).restartAgent(project) | ||
NotificationsManager.getNotificationsManager() | ||
.getNotificationsOfType(CodyConnectionTimeoutExceptionNotification::class.java, project) | ||
.forEach { it.expire() } | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AboutAction
here seems to be redundant. It makes the action group overpopulated. The GitHub report fills the about info automatically.