Tweaks to support prompt line number format (#2121)

This commit is contained in:
Matt Rubens 2025-03-30 14:28:34 -04:00 committed by GitHub
parent d3df954797
commit 60e122f2ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 10 deletions

View file

@ -10,8 +10,7 @@ describe("Code Action Prompts", () => {
filePath: testFilePath,
selectedText: testCode,
})
expect(prompt).toContain(`@/${testFilePath}`)
expect(prompt).toContain(testFilePath)
expect(prompt).toContain(testCode)
expect(prompt).toContain("purpose and functionality")
expect(prompt).toContain("Key components")
@ -25,8 +24,7 @@ describe("Code Action Prompts", () => {
filePath: testFilePath,
selectedText: testCode,
})
expect(prompt).toContain(`@/${testFilePath}`)
expect(prompt).toContain(testFilePath)
expect(prompt).toContain(testCode)
expect(prompt).toContain("Address all detected problems")
expect(prompt).not.toContain("Current problems detected")
@ -64,8 +62,7 @@ describe("Code Action Prompts", () => {
filePath: testFilePath,
selectedText: testCode,
})
expect(prompt).toContain(`@/${testFilePath}`)
expect(prompt).toContain(testFilePath)
expect(prompt).toContain(testCode)
expect(prompt).toContain("Code readability")
expect(prompt).toContain("Performance optimization")

View file

@ -35,7 +35,7 @@ const supportPromptConfigs: Record<string, SupportPromptConfig> = {
\${userInput}`,
},
EXPLAIN: {
template: `Explain the following code from file path @/\${filePath} \${startLine}:\${endLine}
template: `Explain the following code from file path \${filePath}:\${startLine}-\${endLine}
\${userInput}
\`\`\`
@ -48,7 +48,7 @@ Please provide a clear and concise explanation of what this code does, including
3. Important patterns or techniques used`,
},
FIX: {
template: `Fix any issues in the following code from file path @/\${filePath} \${startLine}:\${endLine}
template: `Fix any issues in the following code from file path \${filePath}:\${startLine}-\${endLine}
\${diagnosticText}
\${userInput}
@ -63,7 +63,7 @@ Please:
4. Explain what was fixed and why`,
},
IMPROVE: {
template: `Improve the following code from file path @/\${filePath} \${startLine}:\${endLine}
template: `Improve the following code from file path \${filePath}:\${startLine}-\${endLine}
\${userInput}
\`\`\`
@ -79,7 +79,7 @@ Please suggest improvements for:
Provide the improved code along with explanations for each enhancement.`,
},
ADD_TO_CONTEXT: {
template: `\${filePath}:\${startLine}:\${endLine}
template: `\${filePath}:\${startLine}-\${endLine}
\`\`\`
\${selectedText}
\`\`\``,