Stacks

Rename a symbol across your Phoenix repo in 2026 with Atlas

Updated 7 min read

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.

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.

Step by step

  1. 01Initiate the rename: Start Atlas in your Phoenix application directory containing mix.exs and lib/<app>_web.
  2. 02Identify 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. 03Locate 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. 04Apply 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. 05Verify 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. 06Format the codebase: Ask Atlas to run bash with mix format to apply standard Elixir formatting across the modified files, maintaining code consistency.
  7. 07Final 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. 08Review 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.

Frequently asked questions

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.

Try Atlas in your terminal

The terminal-native AI coding agent. Free core, single binary.

Install Atlas

Related guides

Rename a Symbol Across the Repo with Atlas in 2026

How to rename a symbol across a repo with Atlas in 2026: findReferences gets the true reference set, grep catches strings and docs, and edit refuses ambiguous matches.

Atlas for Phoenix in 2026

Atlas is a terminal-native AI coding agent for Phoenix in 2026. It reads contexts, LiveView modules, and Ecto changesets, then runs mix test behind a prompt.

Upgrade a Dependency and Fix Breakage in Phoenix with Atlas in 2026

Phoenix developers in 2026 use Atlas to direct upgrade dependencies and resolve compile and test failures. Atlas drives Hex, ExUnit, and mix format, ensuring a smooth transition for your Phoenix applications.

Add a Regression Test for a Phoenix Bug Fix with Atlas in 2026

Lock in Phoenix bug fixes with Atlas by writing red-green regression tests. Use `mix test (ExUnit)` and `mix format` to ensure code quality and prevent future regressions in your Phoenix application.

Extract a Shared Helper from Duplicated Code in Phoenix with Atlas in 2026

Refactor your Phoenix application in 2026 by extracting duplicated logic into a single, tested helper using Atlas. Find semantic duplicates, create new modules, and apply changes with full diff review.

Review a pull request in Phoenix with Atlas in 2026

In 2026, Atlas helps Phoenix developers review pull requests by providing deep context, checking Ecto changesets, LiveView modules, and running mix test (ExUnit) with precision.

Trace a Runtime Bug from a Stack Trace in Phoenix with Atlas in 2026

Pinpoint and fix runtime bugs in Phoenix applications using Atlas in 2026. Go from a production stack trace to the exact line of code and a solution, leveraging Phoenix's mix test and Ecto changesets.

Document a module with a README in Phoenix with Atlas in 2026

In 2026, Atlas helps Phoenix developers generate accurate README documentation for modules. It reads your LiveView, Ecto, and context code, ensuring docs reflect current implementation, not outdated plans.

Browse this resource hub