How to rename a symbol safely across a repo
Wann einsetzen: You want a rename that understands scope, not a find-replace.
Voraussetzungen
- Go installed — brew install go
- The LSP for your language — gopls: go install golang.org/x/tools/gopls@latest; pyright: pip install pyright; etc.
- Install the MCP — go install github.com/isaacphi/mcp-language-server@latest
Ablauf
-
Start the MCP pointed at your workspace + LSPAdd MCP config: command=mcp-language-server, args=['--workspace','.','--lsp','gopls'].✓ Kopiert→ Tools appear
-
Find references firstreferences for symbol 'LegacyAuth' in file auth.go.✓ Kopiert→ Precise cross-repo references
-
Renamerename_symbol 'LegacyAuth' -> 'Auth' at the definition site.✓ Kopiert→ All callsites updated correctly
Ergebnis: Semantically-correct rename across the repo.
Fallstricke
- Agent falls back to text find-replace when the tool fails — Verify diagnostics after rename — compile errors mean the LSP refused and the agent cheated