Rename a symbol safely across the whole project
Wann einsetzen: You want to rename a symbol but grep-and-replace would miss string references or dynamic calls.
Voraussetzungen
- MCP Server plugin installed in the IDE — plugins.jetbrains.com/plugin/26071-mcp-server — or built-in if on 2025.2+
- Project opened and indexed in the IDE — Open the project; wait for indexing to complete (status bar)
Ablauf
-
Find the symbolFind the definition and all usages of
getCurrentUserin the project. Include test files.✓ Kopiert→ IDE-accurate usage list with file:line -
Dry-run the renameShow me what renaming to
getAuthenticatedUserwould change. Flag any string literals or reflection-based calls I'll need to fix manually.✓ Kopiert→ Preview diff + manual-fix list -
Apply the refactorApply the rename. Then run the affected tests.✓ Kopiert→ Refactor done, tests green
Ergebnis: A safe rename with IDE-level accuracy, covered by the IDE's existing refactoring engine.
Fallstricke
- Reflection-based or string-built references aren't caught — After refactor, grep for the old name as a string — the IDE warns but doesn't auto-fix these
- IDE not fully indexed, results are partial — Wait for the progress bar to clear before running; ask the IDE for index status first