Browse Source

Tweaks to support prompt line number format (#2121)

Matt Rubens 9 months ago
parent
commit
60e122f2ca
2 changed files with 7 additions and 10 deletions
  1. 3 6
      src/shared/__tests__/support-prompts.test.ts
  2. 4 4
      src/shared/support-prompt.ts

+ 3 - 6
src/shared/__tests__/support-prompts.test.ts

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

+ 4 - 4
src/shared/support-prompt.ts

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