[PR #1287] [MERGED] fix: edit tool #9878

Closed
opened 2026-02-16 18:14:19 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1287
Author: @neriousy
Created: 7/24/2025
Status: Merged
Merged: 7/24/2025
Merged by: @thdxr

Base: devHead: fix/edit-tool


📝 Commits (3)

  • be6bf78 feat: proper leveshtein usage
  • 5a1c0f0 fix: move back the order of the replacers
  • a21b2a1 docs: add source approach

📊 Changes

2 files changed (+228 additions, -31 deletions)

View changed files

📝 packages/opencode/src/tool/edit.ts (+146 -31)
📝 packages/opencode/test/tool/edit.test.ts (+82 -0)

📄 Description

Adjusted the edit tool based off https://github.com/cline/cline/blob/main/evals/diff-edits/diff-apply/diff-06-26-25.ts

What was broken: The tool used to just grab the first matching block it found, which could be
completely wrong if you had similar-looking code elsewhere in the file.

closes!1261 https://github.com/sst/opencode/issues/1261


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1287 **Author:** [@neriousy](https://github.com/neriousy) **Created:** 7/24/2025 **Status:** ✅ Merged **Merged:** 7/24/2025 **Merged by:** [@thdxr](https://github.com/thdxr) **Base:** `dev` ← **Head:** `fix/edit-tool` --- ### 📝 Commits (3) - [`be6bf78`](https://github.com/anomalyco/opencode/commit/be6bf78a23def8dca42253233ca6b6fb36720305) feat: proper leveshtein usage - [`5a1c0f0`](https://github.com/anomalyco/opencode/commit/5a1c0f06c58e6ebba1fe9d06152dd73f3f47f132) fix: move back the order of the replacers - [`a21b2a1`](https://github.com/anomalyco/opencode/commit/a21b2a17d9214352e3eef9430482f5b41c1e9f00) docs: add source approach ### 📊 Changes **2 files changed** (+228 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `packages/opencode/src/tool/edit.ts` (+146 -31) 📝 `packages/opencode/test/tool/edit.test.ts` (+82 -0) </details> ### 📄 Description Adjusted the edit tool based off https://github.com/cline/cline/blob/main/evals/diff-edits/diff-apply/diff-06-26-25.ts What was broken: The tool used to just grab the first matching block it found, which could be completely wrong if you had similar-looking code elsewhere in the file. closes!1261 https://github.com/sst/opencode/issues/1261 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:19 -05:00
yindo closed this issue 2026-02-16 18:14:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9878