Skip to content

Conversation

lramos15
Copy link
Member

Adds a sparkle to chat

@lramos15 lramos15 self-assigned this Sep 16, 2025
@lramos15 lramos15 requested a review from joshspicer September 16, 2025 21:26
@lramos15 lramos15 marked this pull request as ready for review September 16, 2025 21:26
@Copilot Copilot AI review requested due to automatic review settings September 16, 2025 21:26
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a chat enhance action that provides AI-powered prompt enhancement functionality to VS Code's chat interface. The feature allows users to improve their chat prompts with AI suggestions through a sparkle icon button.

Key changes:

  • Introduces a new chat enhance action with AI-powered prompt optimization
  • Adds context key for tracking enhance operation state
  • Implements fallback enhancement logic when AI is unavailable

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/vs/workbench/contrib/chat/common/chatContextKeys.ts Adds context key for tracking enhance operation progress
src/vs/workbench/contrib/chat/browser/media/chat.css Adds styling for the sparkle enhance button with hover effects
src/vs/workbench/contrib/chat/browser/chat.contribution.ts Registers the new chat enhance actions module
src/vs/workbench/contrib/chat/browser/actions/chatEnhanceActions.ts Implements the complete chat enhance functionality with AI integration and fallback logic

Comment on lines +86 to +88
// Add a small delay to see the spinner in action during development/testing
await new Promise(resolve => setTimeout(resolve, 1000));

Copy link
Preview

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

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

This hardcoded 1-second delay appears to be for testing purposes and should be removed from production code. Consider removing this line or making it conditional based on a debug flag.

Suggested change
// Add a small delay to see the spinner in action during development/testing
await new Promise(resolve => setTimeout(resolve, 1000));

Copilot uses AI. Check for mistakes.

}];

// Use the proper ExtensionIdentifier constructor for the chat enhance feature
const extensionId = new ExtensionIdentifier('core');
Copy link
Preview

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

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

Using 'core' as an extension identifier may not be appropriate for the chat enhance feature. Consider using a more specific identifier that represents the chat enhancement functionality, such as 'vscode.chat-enhance' or similar.

Suggested change
const extensionId = new ExtensionIdentifier('core');
const extensionId = new ExtensionIdentifier('vscode.chat-enhance');

Copilot uses AI. Check for mistakes.

Comment on lines +138 to +142
const enhancementPrompt = `You are an expert prompt engineer specializing in optimizing prompts for AI assistants. Your goal is to transform user prompts into more effective versions that will yield better, more useful responses.
Original prompt: "${input}"
Transform this prompt by applying these enhancement strategies:
Copy link
Preview

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

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

This large prompt template should be extracted to a constant or external resource for better maintainability. Consider moving it to a separate constant at the top of the file or to a dedicated prompt template file.

Copilot uses AI. Check for mistakes.

Comment on lines +247 to +250
// Check if the prompt is too vague
if (input.length < 15) {
improvements.push('Please provide more specific details about what you are trying to accomplish.');
}
Copy link
Preview

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

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

The magic number 15 for determining if a prompt is too vague should be extracted to a named constant to improve code readability and maintainability.

Copilot uses AI. Check for mistakes.

@vs-code-engineering vs-code-engineering bot added this to the September 2025 milestone Sep 16, 2025
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.

1 participant