-
Notifications
You must be signed in to change notification settings - Fork 35.5k
feat: display description of prompt as placeholder text when user types /{prompt}
in chat input
#271187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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); |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
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.
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); |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
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()
.
this.resolvePromptDescription(slashPromptPart); | |
this.resolvePromptDescription(slashPromptPart).catch(err => { | |
console.error('Failed to resolve prompt description:', err); | |
}); |
Copilot uses AI. Check for mistakes.
display description of prompt as placeholder text when user types
/{prompt}
in chat inputFixes: #269237