# Rename a symbol across your Phoenix repo in 2026 with Atlas

> Atlas renames symbols in Phoenix by combining lsp for code references, grep for documentation, and edit for precise, permission-gated changes.

To rename a function, class, or constant across your Phoenix application in 2026, Atlas leverages the lsp tool's findReferences to get an authoritative list from the language server, then uses grep to catch non-code occurrences, and edit for precise mechanical replacements, ensuring your mix test (ExUnit) suite passes and mix format maintains consistency.

## Key takeaways

- Atlas uses lsp for precise code reference renaming in Phoenix.
- grep catches non-code occurrences in Phoenix LiveView templates and config.
- Atlas verifies Phoenix refactors with mix test (ExUnit) and mix format.
- Unified diffs and permission prompts ensure safe, transparent changes.
- Atlas integrates with git for easy review and commit of Phoenix refactors.

## How Atlas renames symbols in Phoenix codebases

Atlas renames symbols across your Phoenix application by orchestrating a 3-step process in 2026. It first queries the language server via lsp for all true code references, then uses grep to find non-code occurrences like strings or comments, and finally applies changes with edit.

When renaming a symbol in a Phoenix application, Atlas initiates the process by using the lsp tool's findReferences operation. This leverages the language server to identify all authoritative code callsites for the function, class, or constant, ensuring that references within LiveView modules, Ecto schemas, and context functions are precisely located. Following this, Atlas employs grep to scan for occurrences outside the strict type system, such as string literals in .eex templates, comments, or configuration entries in config/config.exs. Finally, the edit tool applies these mechanical renames using replaceAll. Atlas's edit tool is designed for safety; it refuses ambiguous single replacements, preventing unintended matches from corrupting your Phoenix codebase. This multi-faceted approach ensures a comprehensive and accurate refactor across all layers of your Phoenix project.

## Ensuring rename accuracy with Phoenix's toolchain

After Atlas performs a symbol rename in your Phoenix project, it integrates directly with your existing toolchain to verify correctness. Atlas uses bash to run mix test (ExUnit) and mix format, ensuring the 2026 refactor is robust and adheres to project standards.

After Atlas has proposed and applied a symbol rename within your Phoenix project, it immediately moves to verification using the bash tool. Atlas executes mix test (ExUnit) to run your entire test suite, confirming that the refactoring has not introduced any regressions and that the application compiles correctly. This critical step ensures the integrity of your Phoenix application's business logic, whether it resides in contexts or handles LiveView sockets. Following successful test execution, Atlas can then run mix format via bash to automatically apply the standard Elixir formatting rules across all modified files. This maintains code consistency and readability, which is vital in collaborative Phoenix development. A final grep for the old symbol name is performed to definitively prove that zero instances of the old name remain anywhere in the repository, providing a robust guarantee of completeness.

## Reviewing and approving Atlas's Phoenix refactors

Every symbol rename Atlas proposes for your Phoenix codebase undergoes a rigorous review process before any files are written. Atlas drafts a plan in a read-only agent, computes a unified diff for each file edit, and presents it for your approval, ensuring 100% transparency.

Atlas prioritizes safety and transparency throughout the refactoring process for your Phoenix application. Before any changes are written to disk, Atlas drafts a comprehensive plan in a read-only plan agent, detailing every proposed step. Once the plan is approved, Atlas computes a unified diff for every single file edit, presenting these changes for your explicit approval. This granular review process allows you to inspect every modification, from changes in lib/my_app_web/router.ex to updates in Ecto changesets. All Atlas tool calls, including lsp, grep, edit, and bash, are permission-gated, requiring your consent before execution. Furthermore, Atlas integrates with git, creating snapshots of file changes as git patches. This capability allows for easy diffing and rolling back of edits, providing a robust safety net for any refactoring operation within your Phoenix codebase.

## Handling Phoenix-specific rename challenges

Renaming symbols in a Phoenix application often involves more than just code, touching LiveView templates or Ecto migrations. Atlas's hybrid semantic and keyword retrieval, fused by reciprocal rank fusion, helps it find 2026 occurrences that a pure AST search might miss.

Renaming symbols in a Phoenix application often presents unique challenges beyond typical code references, especially with elements like LiveView templates, Ecto migrations, or specific configuration files. Atlas addresses this by employing a hybrid semantic and keyword retrieval system, fused by reciprocal rank fusion. While lsp provides precise AST-based references for Elixir modules and functions, grep is crucial for catching occurrences in non-code contexts. This includes string literals in .eex or .heex templates, comments, documentation, or even dynamic references within config/config.exs. For instance, renaming a function used in a LiveView assigns map or a constant referenced in an Ecto migration requires this combined approach to ensure all 2026 instances are updated. Atlas's ability to index code by AST declarations using tree-sitter, combined with keyword search, ensures comprehensive coverage across the diverse surface area of a Phoenix project, including contexts, LiveView sockets, and Ecto changesets.

## Steps

1. Initiate the rename: Start Atlas in your Phoenix application directory containing mix.exs and lib/<app>_web.
2. Identify code references: Ask Atlas to run the lsp tool's findReferences operation on the target symbol (e.g., a function in lib/my_app/context.ex) to get the authoritative callsite list from the language server.
3. Locate non-code occurrences: Instruct Atlas to run grep for the old symbol name across your Phoenix project to catch occurrences outside the type system, such as strings in LiveView templates, comments, documentation, or config/config.exs.
4. Apply mechanical changes: Direct Atlas to use the edit tool with replaceAll to apply the mechanical renames where the match is unambiguous per file. For single occurrences, edit enforces uniqueness, preventing unintended matches.
5. Verify compilation and tests: Have Atlas execute the bash tool to run mix test (ExUnit) to ensure the Phoenix application compiles and all tests pass after the rename.
6. Format the codebase: Ask Atlas to run bash with mix format to apply standard Elixir formatting across the modified files, maintaining code consistency.
7. Final old name check: Instruct Atlas to run grep once more for the old symbol name to confirm zero remaining hits, proving the rename is complete.
8. Review and commit: Review the unified diffs presented by Atlas, approve the changes, and allow Atlas to stage and create a git commit on your behalf.

## FAQ

### Can Atlas rename a function used in a Phoenix LiveView template?

Yes, Atlas uses lsp for code references and grep to find string occurrences in files like .eex or .heex templates, ensuring comprehensive renaming across your Phoenix LiveView components.

### How does Atlas handle renaming an Ecto schema field in Phoenix?

Atlas will use lsp to find references in your Ecto schemas and changesets, and grep to catch any string literals in migrations or queries. It can also generate an Ecto migration for schema changes.

### What if Atlas finds multiple matches for a single rename in a Phoenix file?

The edit tool in Atlas refuses ambiguous single replacements. If it finds multiple matches for an old string, it will throw an error unless you add more context or explicitly opt into replaceAll for that specific file.

### Does Atlas run mix test automatically after a rename in Phoenix?

Yes, Atlas can execute bash commands, including mix test (ExUnit), behind a permission prompt. This ensures your Phoenix application remains functional and all tests pass after a refactoring operation.

### How does Atlas ensure my Phoenix code adheres to formatting standards after a rename?

After performing edits, Atlas can run bash with mix format to automatically apply your project's Elixir formatting rules, ensuring consistency across your Phoenix codebase.

### Can I review the changes Atlas makes to my Phoenix project before they are saved?

Absolutely. Atlas computes a unified diff for every file edit and surfaces it for your approval before writing any changes to disk. It also snapshots file changes as git patches for easy rollback.

### Is Atlas aware of Phoenix contexts and router pipelines during a rename?

Yes, Atlas builds its code index using AST declarations via tree-sitter, allowing it to understand the structure of your Phoenix contexts, LiveView modules, and router pipelines, leading to more accurate refactoring.

---

Canonical HTML: https://runatlas.sh/resources/stacks/rename-a-symbol-across-the-repo-in-phoenix
Source of truth: aeo_pages row `/resources/stacks/rename-a-symbol-across-the-repo-in-phoenix` (segment: Stacks) (this file is generated from it, never hand-edited).
Licence: Atlas is proprietary with a free core. It is not open source and there is no public source repository.
