Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Feb 2, 2026

Related GitHub Issue

Closes: #11151

Description

This PR implements the Saved Prompts feature as requested in issue #11151. Users can now create, manage, and quickly access saved prompts during chat.

Key implementation details:

  • Type definitions (packages/types/src/saved-prompt.ts): Zod schema for SavedPrompt with id, name, content, description, apiConfigId, and timestamps
  • Backend handlers (src/core/webview/webviewMessageHandler.ts): Full CRUD operations for saved prompts with import/export functionality
  • Settings UI (webview-ui/src/components/settings/SavedPromptsSettings.tsx): Complete settings panel for managing saved prompts
  • Chat dropdown (webview-ui/src/components/chat/SavedPromptsDropdown.tsx): Bookmark icon dropdown near chat input for quick prompt access
  • State management: Integration with ExtensionStateContext for reactive updates
  • Translations: English translations for all UI strings

Features implemented per user confirmation:

  1. Prompt insertion replaces current input text
  2. Auto-switch to associated API configuration when selecting a prompt
  3. Import/export support for saved prompts as JSON
  4. Prompts stored in global settings for persistence

Test Procedure

  1. Open Roo Code extension
  2. Go to Settings > Saved Prompts section
  3. Create a new saved prompt with name, content, and optionally an API configuration
  4. Verify the prompt appears in the list
  5. Edit and delete prompts to verify CRUD operations
  6. Test import/export functionality
  7. In the chat view, click the bookmark icon near the input
  8. Select a saved prompt and verify it replaces the current input
  9. If an API config was associated, verify it auto-switches

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue
  • Scope: Changes are focused on the saved prompts feature
  • Self-Review: Code follows existing patterns in the codebase
  • Testing: Unit tests to be added in a follow-up PR if needed
  • Documentation Impact: Documentation may need updates for new feature
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines

Documentation Updates

  • Yes, documentation updates may be required to document the new Saved Prompts feature.

Additional Notes

This implementation follows existing patterns used in SlashCommandsSettings and SkillsSettings for consistency. The feature uses the existing global state persistence mechanism for storing saved prompts.


Important

Adds a saved prompts feature with CRUD operations, UI components, state management, and translations.

  • Behavior:
    • Adds saved prompts feature with full CRUD operations in webviewMessageHandler.ts.
    • Supports import/export of prompts as JSON.
    • Prompts replace current input text and auto-switch API configuration.
  • UI Components:
    • SavedPromptsDropdown.tsx: Dropdown for quick access to saved prompts in chat.
    • SavedPromptsSettings.tsx: Settings panel for managing saved prompts.
  • State Management:
    • Integrates with ExtensionStateContext for reactive updates.
  • Type Definitions:
    • Adds savedPrompt.ts for prompt schema and types.
  • Translations:
    • Adds English translations for new UI strings in chat.json and settings.json.

This description was created by Ellipsis for 0be1980. You can customize this summary. It will automatically update as commits are pushed.

Implements the Saved Prompts feature as requested in issue #11151.

Features:
- Create, edit, and delete saved prompts
- Associate prompts with specific API configurations
- Auto-switch API config when using a prompt
- Import/export saved prompts as JSON
- Bookmark icon dropdown near chat input for quick access
- Full CRUD management in Settings

Files added/modified:
- packages/types/src/saved-prompt.ts: Zod schema and types
- packages/types/src/global-settings.ts: Add savedPrompts to schema
- packages/types/src/vscode-extension-host.ts: Message types
- src/core/webview/webviewMessageHandler.ts: CRUD handlers
- webview-ui/src/components/settings/SavedPromptsSettings.tsx: Settings UI
- webview-ui/src/components/chat/SavedPromptsDropdown.tsx: Chat dropdown
- webview-ui/src/context/ExtensionStateContext.tsx: State management
- webview-ui/src/i18n/locales/en/settings.json: Translations
- webview-ui/src/i18n/locales/en/chat.json: Translations

Closes #11151
@roomote
Copy link
Contributor Author

roomote bot commented Feb 2, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. Found 3 issues that should be addressed before merging.

  • Missing backend translation keys in src/i18n/locales/en/common.json for savedPrompts.* keys used in webviewMessageHandler.ts
  • Unused imports useRef and ChevronDown in SavedPromptsDropdown.tsx
  • Unused import Trans in SavedPromptsSettings.tsx

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Comment on lines +3272 to +3282
title: t("common:savedPrompts.exportTitle"),
})

if (saveUri) {
await fs.writeFile(saveUri.fsPath, JSON.stringify(exportData, null, 2), "utf8")
vscode.window.showInformationMessage(t("common:savedPrompts.exportSuccess"))
await saveLastExportPath(provider, "lastSavedPromptsExportPath", saveUri.fsPath)
}
} catch (error) {
provider.log(`Error exporting saved prompts: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`)
vscode.window.showErrorMessage(t("common:savedPrompts.exportError"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The translation keys used here (common:savedPrompts.exportTitle, common:savedPrompts.exportSuccess, common:savedPrompts.exportError, etc.) are not defined in src/i18n/locales/en/common.json. This will cause the i18n system to display raw keys like "common:savedPrompts.exportTitle" instead of user-friendly text in VS Code dialogs. The savedPrompts object needs to be added to the backend's common.json locale file with keys for exportTitle, exportSuccess, exportError, importTitle, invalidFormat, importSuccess, and importError.

Fix it with Roo Code or mention @roomote and request a fix.

Comment on lines +1 to +2
import React, { useEffect, useRef, useState } from "react"
import { Bookmark, ChevronDown, Settings } from "lucide-react"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useRef and ChevronDown are imported but never used in this file. These should be removed to keep the code clean.

Suggested change
import React, { useEffect, useRef, useState } from "react"
import { Bookmark, ChevronDown, Settings } from "lucide-react"
import React, { useEffect, useState } from "react"
import { Bookmark, Settings } from "lucide-react"

Fix it with Roo Code or mention @roomote and request a fix.

@@ -0,0 +1,353 @@
import React, { useState, useEffect } from "react"
import { Plus, Trash2, Edit2, Download, Upload, Bookmark } from "lucide-react"
import { Trans } from "react-i18next"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trans is imported but never used in this file. Consider removing this unused import.

Suggested change
import { Trans } from "react-i18next"
import React, { useState, useEffect } from "react"

Fix it with Roo Code or mention @roomote and request a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT]

1 participant