bingocode 1.1.177 → 1.1.179
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -73,6 +73,7 @@ import {
|
|
|
73
73
|
areFileEditsInputsEquivalent,
|
|
74
74
|
findActualString,
|
|
75
75
|
findClosestLines,
|
|
76
|
+
findFuzzySuggestion,
|
|
76
77
|
getPatchForEdit,
|
|
77
78
|
preserveQuoteStyle,
|
|
78
79
|
visibleWhitespace,
|
|
@@ -317,11 +318,15 @@ export const FileEditTool = buildTool({
|
|
|
317
318
|
// Use findActualString to handle quote normalization
|
|
318
319
|
const actualOldString = findActualString(file, old_string)
|
|
319
320
|
if (!actualOldString) {
|
|
320
|
-
|
|
321
|
+
const BASE = 'String to replace not found.'
|
|
321
322
|
const matches = findClosestLines(file, old_string)
|
|
323
|
+
const fuzzy = findFuzzySuggestion(file, old_string)
|
|
324
|
+
const fuzzyBlock = fuzzy
|
|
325
|
+
? `\n\nDid you mean:\n line ${fuzzy.lineNumber}: ${visibleWhitespace(fuzzy.suggestion)}\n (edit distance ${fuzzy.distance})`
|
|
326
|
+
: ''
|
|
322
327
|
const msg = matches.length
|
|
323
|
-
|
|
324
|
-
: `${BASE}.\n→ = tab · = space\nProvided:\n${visibleWhitespace(old_string)}\n↑ check visible whitespace markers above.`
|
|
328
|
+
? `${BASE}\n→ = tab · = space\nProvided:\n${visibleWhitespace(old_string)}\nClosest matches:\n${matches.map(m => ` line ${m.lineNumber} (${m.diffType})\n ${visibleWhitespace(m.snippet)}`).join('\n')}${fuzzyBlock}\n↑ check visible whitespace markers above.`
|
|
329
|
+
: `${BASE}.\n→ = tab · = space\nProvided:\n${visibleWhitespace(old_string)}${fuzzyBlock}\n↑ check visible whitespace markers above.`
|
|
325
330
|
return {
|
|
326
331
|
result: false,
|
|
327
332
|
behavior: 'ask',
|