Skip to content

Conversation

bryanchen-d
Copy link
Contributor

@bryanchen-d bryanchen-d commented Oct 13, 2025

display description of prompt as placeholder text when user types /{prompt} in chat input

Fixes: #269237

@bryanchen-d bryanchen-d added this to the October 2025 milestone Oct 13, 2025
@bryanchen-d bryanchen-d added chat-input chat-prompts Prompt and Instruction files related issues labels Oct 13, 2025
@bryanchen-d bryanchen-d self-assigned this Oct 13, 2025
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 functionality to display prompt descriptions as placeholder text when users type /prompt commands in the chat input. The feature enhances user experience by providing contextual help about what each prompt does directly in the input field.

Key Changes

  • Added prompt description resolution and caching system
  • Implemented placeholder text display for prompt slash commands
  • Added event listener to refresh cached descriptions when prompts change

}
}

const onlyPromptCommandAndWhitespace = slashPromptPart && parsedRequest.every(p => p instanceof ChatRequestTextPart && !p.text.trim().length || p instanceof ChatRequestSlashPromptPart);
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

The boolean expression is complex and hard to read. Consider extracting the predicate function or breaking it into multiple conditions with descriptive variable names.

Suggested change
const onlyPromptCommandAndWhitespace = slashPromptPart && parsedRequest.every(p => p instanceof ChatRequestTextPart && !p.text.trim().length || p instanceof ChatRequestSlashPromptPart);
function isWhitespaceOrPromptPart(p: IParsedChatRequestPart): boolean {
return (p instanceof ChatRequestTextPart && !p.text.trim().length) || (p instanceof ChatRequestSlashPromptPart);
}
const onlyPromptCommandAndWhitespace = slashPromptPart && parsedRequest.every(isWhitespaceOrPromptPart);

Copilot uses AI. Check for mistakes.

}];
} else if (!this.pendingPromptResolutions.has(slashPromptPart.slashPromptCommand.command)) {
// Try to resolve the description asynchronously
this.resolvePromptDescription(slashPromptPart);
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

The async call to resolvePromptDescription is made without awaiting or handling potential errors, which could lead to unhandled promise rejections. Consider adding error handling or making this a fire-and-forget operation with explicit .catch().

Suggested change
this.resolvePromptDescription(slashPromptPart);
this.resolvePromptDescription(slashPromptPart).catch(err => {
console.error('Failed to resolve prompt description:', err);
});

Copilot uses AI. Check for mistakes.

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

Labels

chat-input chat-prompts Prompt and Instruction files related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat: Prompts should show the description (later the placeholder) as placeholder

1 participant