Skip to content

Commit af50704

Browse files
committed
fix
1 parent 259f090 commit af50704

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/inline/InlineChatActionPromoter.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,24 @@ class InlineChatActionPromoter : ActionPromoter {
1414
// temporary until we find a better key binding
1515
override fun promote(actions: MutableList<out AnAction>, context: DataContext): MutableList<AnAction> {
1616
val results = actions.toMutableList()
17-
if (context.getData(CommonDataKeys.EDITOR) == null || context.getData(CommonDataKeys.PROJECT) == null) return results
17+
if (context.getData(CommonDataKeys.EDITOR) == null ||
18+
context.getData(CommonDataKeys.PROJECT) == null
19+
) {
20+
return results
21+
}
1822
val shortCut = KeymapUtil.getShortcutText("aws.toolkit.jetbrains.core.services.cwc.inline.openChat")
1923
// only promote for the default key bindings
2024
if (SystemInfo.isMac && shortCut != "⌘I") return results
2125
if (!SystemInfo.isMac && shortCut != "Ctrl+I") return results
2226

23-
return actions.sortedBy { a, b ->
27+
results.sortWith { a, b ->
2428
when {
2529
isOpenChatInputAction(a) -> -1
2630
isOpenChatInputAction(b) -> 1
2731
else -> 0
2832
}
2933
}
34+
return results
3035
}
3136

3237
private fun isOpenChatInputAction(action: AnAction): Boolean =

0 commit comments

Comments
 (0)