Compare commits

...
Author SHA1 Message Date
Sarah Fortune 1d0e5f7505 Don't show ESC on the Cancel button on JetBrains
The ESC keyboard shortcut doesn't work on JetBrains because it is already being used by the IDE.

Fixes FDN-40
2025-09-14 13:18:05 -07:00
3 changed files with 18 additions and 4 deletions
@@ -1,5 +1,6 @@
import type { ClineMessage, ClineSayTool } from "@shared/ExtensionMessage"
import type { Mode } from "@shared/storage/types"
import { PLATFORM_CONFIG } from "@/config/platform.config"
/**
* Button action types that determine the behavior
@@ -183,7 +184,7 @@ export const BUTTON_CONFIGS: Record<string, ButtonConfig> = {
sendingDisabled: true,
enableButtons: true,
primaryText: undefined,
secondaryText: "Cancel (ESC)",
secondaryText: getCancelButtonText(),
primaryAction: undefined,
secondaryAction: "cancel",
},
@@ -201,12 +202,20 @@ export const BUTTON_CONFIGS: Record<string, ButtonConfig> = {
sendingDisabled: true,
enableButtons: true,
primaryText: undefined,
secondaryText: "Cancel (ESC)",
secondaryText: getCancelButtonText(),
primaryAction: undefined,
secondaryAction: "cancel",
},
}
function getCancelButtonText(): string {
var text = "Cancel"
if (PLATFORM_CONFIG.supportsEscShortcut) {
text += " (ESC)"
}
return text
}
const errorTypes = ["api_req_failed", "mistake_limit_reached", "auto_approval_max_req_reached"]
/**
+4 -2
View File
@@ -4,13 +4,15 @@
"showNavbar": false,
"postMessageHandler": "vscode",
"togglePlanActKeys": "Meta+Shift+a",
"supportsTerminalMentions": true
"supportsTerminalMentions": true,
"supportsEscShortcut": true
},
"standalone": {
"messageEncoding": "json",
"showNavbar": true,
"postMessageHandler": "standalone",
"togglePlanActKeys": "Meta+Shift+p",
"supportsTerminalMentions": false
"supportsTerminalMentions": false,
"supportsEscShortcut": false
}
}
+3
View File
@@ -8,6 +8,7 @@ export interface PlatformConfig {
decodeMessage: MessageDecoder
togglePlanActKeys: string
supportsTerminalMentions: boolean
supportsEscShortcut: boolean
}
// Internal type for JSON structure (not exported)
@@ -17,6 +18,7 @@ type PlatformConfigJson = {
postMessageHandler: "vscode" | "standalone"
togglePlanActKeys: string
supportsTerminalMentions: boolean
supportsEscShortcut: boolean
}
type PlatformConfigs = Record<string, PlatformConfigJson>
@@ -84,6 +86,7 @@ export const PLATFORM_CONFIG: PlatformConfig = {
decodeMessage: messageDecoders[selectedConfig.messageEncoding],
togglePlanActKeys: selectedConfig.togglePlanActKeys,
supportsTerminalMentions: selectedConfig.supportsTerminalMentions,
supportsEscShortcut: selectedConfig.supportsEscShortcut,
}
type MessageEncoding = "none" | "json"