refactor: generalize prompt enhancement into single completion handler

- Rename enhance-prompt.ts to single-completion-handler.ts for better clarity
- Refactor enhancement logic to be more generic and reusable
- Update prompt template handling to use template literals
- Adjust tests and imports accordingly
This commit is contained in:
sam hoang
2025-01-24 01:14:48 +07:00
parent 149e86ed0a
commit 085d42873c
5 changed files with 39 additions and 28 deletions

View File

@@ -77,12 +77,11 @@ describe("Code Action Prompts", () => {
describe("ENHANCE action", () => {
it("should format enhance prompt correctly", () => {
const prompt = supportPrompt.create("ENHANCE", {
filePath: testFilePath,
selectedText: testCode,
userInput: "test",
})
expect(prompt).toBe(
"Generate an enhanced version of this prompt (reply with only the enhanced prompt - no conversation, explanations, lead-in, bullet points, placeholders, or surrounding quotes):",
"Generate an enhanced version of this prompt (reply with only the enhanced prompt - no conversation, explanations, lead-in, bullet points, placeholders, or surrounding quotes):\n\ntest",
)
// Verify it ignores parameters since ENHANCE template doesn't use any
expect(prompt).not.toContain(testFilePath)