From ae9cce4de3951f535dbb07b6aa89a352075dfba9 Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Tue, 25 Aug 2026 02:15:09 +0800 Subject: [PATCH] feat: compact snippet list option (#1339) A "Show Commands" toggle in the snippets settings menu hides the command text under each snippet name, for people who dock the panel on the narrow right rail and only need the names. Local preference, on by default. --- src/ui/locales/en.json | 2 ++ src/ui/sidebar/SnippetsPanel.tsx | 34 ++++++++++++++++++++++++++--- src/ui/sidebar/UserProfilePanel.tsx | 1 + 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/ui/locales/en.json b/src/ui/locales/en.json index 3f729f75..64d3017c 100644 --- a/src/ui/locales/en.json +++ b/src/ui/locales/en.json @@ -4286,6 +4286,8 @@ "expandAppRailOnHoverDesc": "Allow the left sidebar app rail to expand when the pointer moves over it", "settingsNavigation": "Navigation", "navigationTabsDesc": "Choose which tabs appear in the app rail", + "showSnippetCommands": "Show Commands", + "showSnippetCommandsDesc": "Show each snippet's command under its name. Turn off for a compact list.", "foldersCollapsed": "Folders Collapsed", "foldersCollapsedDesc": "Collapse folders by default", "confirmExecution": "Confirm Execution", diff --git a/src/ui/sidebar/SnippetsPanel.tsx b/src/ui/sidebar/SnippetsPanel.tsx index 50bc8ebd..f2c7ff62 100644 --- a/src/ui/sidebar/SnippetsPanel.tsx +++ b/src/ui/sidebar/SnippetsPanel.tsx @@ -862,6 +862,7 @@ function ShareSnippetDialog({ function SnippetCard({ snippet, + showCommands, selectedTabIds, terminalTabs, activeTabId, @@ -879,6 +880,7 @@ function SnippetCard({ t, }: { snippet: Snippet; + showCommands: boolean; selectedTabIds: Set; terminalTabs: Tab[]; activeTabId: string; @@ -966,9 +968,11 @@ function SnippetCard({ /> )} - - {snippet.content} - + {showCommands && ( + + {snippet.content} + + )} {targetHosts.length > 0 && (
{targetHosts.map((host) => ( @@ -1246,6 +1250,7 @@ function ExecutionResultDialog({ function VirtualFolderGroup({ folderName, + showCommands, snippets: folderSnippets, selectedTabIds, terminalTabs, @@ -1266,6 +1271,7 @@ function VirtualFolderGroup({ open, onToggleOpen, }: { + showCommands: boolean; folderName: string; snippets: Snippet[]; selectedTabIds: Set; @@ -1312,6 +1318,7 @@ function VirtualFolderGroup({ > {folderSnippets.map((snippet) => ( localStorage.getItem("defaultSnippetFoldersCollapsed") !== "false", ); + // Compact list: names only, the command stays in the tooltip/editor. + const [showCommands, setShowCommands] = useState( + () => localStorage.getItem("snippetShowCommands") !== "false", + ); const [confirmExecution, setConfirmExecution] = useState( () => localStorage.getItem("confirmSnippetExecution") === "true", ); @@ -1961,6 +1972,20 @@ export function SnippetsPanel({ + + { + setShowCommands(v); + localStorage.setItem("snippetShowCommands", v.toString()); + }} + /> + {uncategorizedSnippets.map((snippet) => ( {folderSnippets.map((snippet) => (