Skip to content

Conversation

digitarald
Copy link
Contributor

@digitarald digitarald commented Aug 26, 2025

Summary

This PR introduces a new promptFilesRecommendations configuration setting that allows users to configure which prompt files should be suggested in the chat welcome view based on contextual when-clause expressions or simple boolean values.

image

cc @eli-w-king

Key Features

  • Contextual suggestions: Configure prompt files to appear based on file type, language, or other VS Code context
  • Flexible configuration: Support both boolean values (true/false) and when-clause expressions
  • Smart caching: Async loading of prompt descriptions to avoid blocking UI rendering
  • Unified experience: Suggestions now work in both experimental and regular welcome views

Configuration Example

{
  "promptFilesRecommendations": {
    "plan": true,                            // Always suggest
    "a11y-audit": "resourceExtname == .html", // Only for HTML files  
    "document": "resourceLangId == markdown", // Only for Markdown files
    "debug": false                           // Never suggest
  }
}

Implementation Details

Configuration Schema

  • Added proper JSON schema with oneOf constraints supporting mixed boolean/string types
  • Comprehensive validation and error handling for when-clause parsing
  • Experimental tag with clear documentation and examples

UI Integration

  • Enhanced ChatWidget with intelligent prompt suggestion logic
  • Added description caching to avoid async calls during rendering
  • Graceful fallback when descriptions fail to load

Welcome View Improvements

  • Moved suggested prompts rendering outside experimental-only blocks
  • Updated re-render logic to account for prompt suggestion changes
  • Added helpful onboarding message when no agent-specific welcome exists

Testing

  • ✅ Configuration parsing handles various input types correctly
  • ✅ When-clause evaluation integrates properly with VS Code context system
  • ✅ Error handling gracefully degrades on invalid configurations
  • ✅ UI updates correctly when suggestions change

Related Issues

Enhances the reusable prompts feature by making suggestions context-aware and user-configurable.

Breaking Changes

None - this is an additive feature with sensible defaults.

Copy link
Contributor

@aeschli aeschli left a comment

Choose a reason for hiding this comment

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

Can we use a different name than promptFilesSuggest. We use the term suggestions in the context of code completions.

Maybe 'recommendations'? Or 'favorites'?

  • The setting allows to use context keys in user settings. That might be a first. Context keys are known to extension authors but typically not to regular users. We have a documentation if it, but it's in the extension section. There's no while editing in the settings editor and users might struggle to debug. Do we need the full power?

  • Is there listening for prompt description changes or context changes?

@digitarald digitarald requested a review from aeschli August 26, 2025 16:39
@digitarald
Copy link
Contributor Author

I added a link to the when clause in the settings. Non-extension devs users are also exposed to them for customizing keyboard shortcuts, which is a primary use case.

Given that this is meant to be a out of the box customization driven by power users for their other maintainers; it should be ok to not live-update descriptions, but biasing towards low performance impact and keep iterating on how this is being adopted.

@justschen
Copy link
Collaborator

just a thought, if we have way to categorize suggestions, these icons could maybe be different to reflect that, but not sure how possible that is.

Screenshot 2025-08-26 at 1 48 42 PM

@digitarald
Copy link
Contributor Author

just a thought, if we have way to categorize suggestions, these icons could maybe be different to reflect that, but not sure how possible that is.

Havinc icons for prompts and modes would be neat, I agree. Locally I dropped in a play button and it makes it even more "clickable".

@digitarald digitarald force-pushed the chat/prompt-file-suggestions branch from e951f6c to a6d07f3 Compare August 28, 2025 18:39
@digitarald digitarald requested a review from bhavyaus August 29, 2025 00:08
@bhavyaus bhavyaus force-pushed the chat/prompt-file-suggestions branch from a51098d to 035e0ea Compare August 30, 2025 05:38
@bhavyaus bhavyaus enabled auto-merge (squash) August 30, 2025 05:47
@bhavyaus bhavyaus merged commit 9538d95 into main Aug 30, 2025
18 checks passed
@bhavyaus bhavyaus deleted the chat/prompt-file-suggestions branch August 30, 2025 05:50
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.

4 participants