-
Notifications
You must be signed in to change notification settings - Fork 274
auto-trigger a/b #4961
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
auto-trigger a/b #4961
Changes from all commits
db17201
fa88de2
cc11b69
d994940
33d4e08
2cb9b39
1303b46
e120665
e3e519e
3e923de
4f23afb
b932c2c
0bd02a8
ee630fd
450dbbf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package software.aws.toolkits.jetbrains.services.codewhisperer.actions | ||
|
|
||
| import com.intellij.openapi.actionSystem.ActionUpdateThread | ||
| import com.intellij.openapi.actionSystem.AnAction | ||
| import com.intellij.openapi.actionSystem.AnActionEvent | ||
| import com.intellij.openapi.actionSystem.CommonDataKeys | ||
| import com.intellij.openapi.application.ApplicationManager | ||
| import com.intellij.openapi.project.DumbAware | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.popup.CodeWhispererPopupManager | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererInvocationStatusNew | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererServiceNew | ||
| import software.aws.toolkits.resources.message | ||
Check warningCode scanning / QDJVMC Usage of redundant or deprecated syntax or deprecated symbols Warning
Remove deprecated symbol import
|
||
|
|
||
| open class CodeWhispererAcceptAction(title: String = message("codewhisperer.inline.accept")) : AnAction(title), DumbAware { | ||
|
Check warning on line 17 in plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/actions/CodeWhispererAcceptAction.kt
|
||
| override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT | ||
|
|
||
| override fun update(e: AnActionEvent) { | ||
| e.presentation.isEnabled = e.project != null && e.getData(CommonDataKeys.EDITOR) != null && | ||
| CodeWhispererInvocationStatusNew.getInstance().isDisplaySessionActive() | ||
| } | ||
|
|
||
| override fun actionPerformed(e: AnActionEvent) { | ||
| val sessionContext = e.project?.getUserData(CodeWhispererServiceNew.KEY_SESSION_CONTEXT) ?: return | ||
| if (!CodeWhispererInvocationStatusNew.getInstance().isDisplaySessionActive()) return | ||
| ApplicationManager.getApplication().messageBus.syncPublisher( | ||
| CodeWhispererPopupManager.CODEWHISPERER_USER_ACTION_PERFORMED | ||
| ).beforeAccept(sessionContext) | ||
| } | ||
| } | ||
|
|
||
| // A same accept action but different key shortcut and different promoter logic | ||
| class CodeWhispererForceAcceptAction(title: String = message("codewhisperer.inline.force.accept")) : CodeWhispererAcceptAction(title) | ||
|
Check warning on line 35 in plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/actions/CodeWhispererAcceptAction.kt
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package software.aws.toolkits.jetbrains.services.codewhisperer.actions | ||
|
|
||
| import com.intellij.openapi.actionSystem.ActionUpdateThread | ||
| import com.intellij.openapi.actionSystem.AnAction | ||
| import com.intellij.openapi.actionSystem.AnActionEvent | ||
| import com.intellij.openapi.actionSystem.CommonDataKeys | ||
| import com.intellij.openapi.application.ApplicationManager | ||
| import com.intellij.openapi.project.DumbAware | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.popup.CodeWhispererPopupManager | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererInvocationStatusNew | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererServiceNew | ||
| import software.aws.toolkits.resources.message | ||
|
Check warning on line 15 in plugins/amazonq/codewhisperer/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codewhisperer/actions/CodeWhispererNavigateNextAction.kt
|
||
|
|
||
| class CodeWhispererNavigateNextAction : AnAction(message("codewhisperer.inline.navigate.next")), DumbAware { | ||
Check warningCode scanning / QDJVMC Usage of redundant or deprecated syntax or deprecated symbols Warning
'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
|
||
| override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT | ||
|
|
||
| override fun update(e: AnActionEvent) { | ||
| e.presentation.isEnabled = e.project != null && | ||
| e.getData(CommonDataKeys.EDITOR) != null && | ||
| CodeWhispererInvocationStatusNew.getInstance().isDisplaySessionActive() | ||
| } | ||
|
|
||
| override fun actionPerformed(e: AnActionEvent) { | ||
| val sessionContext = e.project?.getUserData(CodeWhispererServiceNew.KEY_SESSION_CONTEXT) ?: return | ||
| if (!CodeWhispererInvocationStatusNew.getInstance().isDisplaySessionActive()) return | ||
| ApplicationManager.getApplication().messageBus.syncPublisher( | ||
| CodeWhispererPopupManager.CODEWHISPERER_USER_ACTION_PERFORMED | ||
| ).navigateNext(sessionContext) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package software.aws.toolkits.jetbrains.services.codewhisperer.actions | ||
|
|
||
| import com.intellij.openapi.actionSystem.ActionUpdateThread | ||
| import com.intellij.openapi.actionSystem.AnAction | ||
| import com.intellij.openapi.actionSystem.AnActionEvent | ||
| import com.intellij.openapi.actionSystem.CommonDataKeys | ||
| import com.intellij.openapi.application.ApplicationManager | ||
| import com.intellij.openapi.project.DumbAware | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.popup.CodeWhispererPopupManager | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererInvocationStatusNew | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererServiceNew | ||
| import software.aws.toolkits.resources.message | ||
Check warningCode scanning / QDJVMC Usage of redundant or deprecated syntax or deprecated symbols Warning
Remove deprecated symbol import
|
||
|
|
||
| class CodeWhispererNavigatePrevAction : AnAction(message("codewhisperer.inline.navigate.previous")), DumbAware { | ||
Check warningCode scanning / QDJVMC Usage of redundant or deprecated syntax or deprecated symbols Warning
'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
|
||
| override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT | ||
|
|
||
| override fun update(e: AnActionEvent) { | ||
| e.presentation.isEnabled = e.project != null && | ||
| e.getData(CommonDataKeys.EDITOR) != null && | ||
| CodeWhispererInvocationStatusNew.getInstance().isDisplaySessionActive() | ||
| } | ||
|
|
||
| override fun actionPerformed(e: AnActionEvent) { | ||
| val sessionContext = e.project?.getUserData(CodeWhispererServiceNew.KEY_SESSION_CONTEXT) ?: return | ||
| if (!CodeWhispererInvocationStatusNew.getInstance().isDisplaySessionActive()) return | ||
| ApplicationManager.getApplication().messageBus.syncPublisher( | ||
| CodeWhispererPopupManager.CODEWHISPERER_USER_ACTION_PERFORMED | ||
| ).navigatePrevious(sessionContext) | ||
| } | ||
| } | ||
This file was deleted.
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.
can avoid working around typecast issues if you declare a common interface