Add dexter_rename_symbol MCP tool - #85
Open
shanehull wants to merge 1 commit into
Open
Conversation
Workspace-wide rename of a module or function, returned as a unified diff plus any file renames. Nothing is written: the agent applies the diff, performs the listed file moves, and calls dexter_reindex. The rename machinery writes to disk as it collects edits, so a plan/apply split was required: site collection and defdelegate span computation move verbatim from server.go to renameplan.go, where FunctionRenamePlan and ModuleRenamePlan compute the full new content of every affected file without touching disk. The LSP apply path is unchanged; TestFunctionRenamePlan_MatchesApply and TestModuleRenamePlan_MatchesApply assert a plan predicts the applied bytes exactly, and all pre-existing rename tests pass unmodified. internal/diff renders the plans as unified diffs, covered by golden tests including the missing-trailing-newline cases.
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #84 (this PR's base is its
feat/mcp-serverbranch and it merges after it).What
Adds
dexter_rename_symbol: workspace-wide rename of a module or function over MCP, returned as a unified diff plus a list of file renames. Nothing is written. The agent applies the diff, performs the listed file moves (module renames follow the file naming convention, including submodule cascades), then callsdexter_reindex.Why the refactor
The existing rename machinery writes to disk while it collects edits (closed files are written directly; only open buffers come back as TextEdits). A "return a diff, don't write" tool cannot be built on that, so this PR splits rename into plan and apply:
as:-span computation moved verbatim fromserver.gotorenameplan.go(git diffshows the block deletion; the logic is unchanged).FunctionRenamePlan/ModuleRenamePlancompute the full new content of every affected file, plus conventional new paths for moved files, without touching disk.renameFunctionEdits,moduleRename) is unchanged in behavior and consumes the same shared pieces.Correctness
TestFunctionRenamePlan_MatchesApplyandTestModuleRenamePlan_MatchesApply: after computing a plan, the LSP apply path runs and every plannedNewTextmust byte-match what landed on disk, and every changed file must be in the plan. This pins the two paths together permanently.TestRenameTool_DoesNotModifyDiskhashes every file before/after tool calls.internal/diff(new, self-contained) is covered by golden tests, including the missing-trailing-newline cases (expected outputs were validated againstgit applywhen written).Manually exercised on a large codebase: a 30-file rename plan (62 call sites) computed in 52ms, working tree verified untouched.