Browse Source

fix: restore working settings link in command permissions tooltip (#6253)

- Replace broken command URI with onClick handler that posts message
- Command URIs don't work in webview context, must use postMessage
- Restores original working implementation from PR #5798
- Directs to autoApprove section where command permissions are configured

The bug was introduced in commit 77bc9e6f when the tooltip was updated
to use command URI instead of the working onClick pattern.
Daniel 5 tháng trước cách đây
mục cha
commit
4d0550c855
1 tập tin đã thay đổi với 9 bổ sung1 xóa
  1. 9 1
      webview-ui/src/components/chat/CommandPatternSelector.tsx

+ 9 - 1
webview-ui/src/components/chat/CommandPatternSelector.tsx

@@ -31,6 +31,10 @@ export const CommandPatternSelector: React.FC<CommandPatternSelectorProps> = ({
 	const [isExpanded, setIsExpanded] = useState(false)
 	const [editingStates, setEditingStates] = useState<Record<string, { isEditing: boolean; value: string }>>({})
 
+	const handleOpenSettings = () => {
+		window.postMessage({ type: "action", action: "settingsButtonClicked", values: { section: "autoApprove" } })
+	}
+
 	// Create a combined list with full command first, then patterns
 	const allPatterns = useMemo(() => {
 		// Trim the command to ensure consistency with extracted patterns
@@ -90,7 +94,11 @@ export const CommandPatternSelector: React.FC<CommandPatternSelectorProps> = ({
 									components={{
 										settingsLink: (
 											<VSCodeLink
-												href="command:workbench.action.openSettings?%5B%22roo-code%22%5D"
+												href="#"
+												onClick={(e) => {
+													e.preventDefault()
+													handleOpenSettings()
+												}}
 												className="text-vscode-textLink-foreground hover:text-vscode-textLink-activeForeground"
 											/>
 										),