Skip to content

Rename & refactor

Rename a symbol in every file, move symbols and files without breaking imports, extract functions, and clean up imports, all by asking Empryo in plain words.

Recipes1 minute to read
Copy & share
On this page6 sections

You can ask for common refactors in plain words. Empryo uses your project's language server (the same one your editor uses) to make the change in every affected file, so you do not have to find and fix each reference yourself.

Rename a symbol everywhereLink to this section

> rename UserService to AccountService

The agent renames the symbol and updates every reference in one step. It works for functions, classes, types, interfaces, variables, and enums. You do not need to say which file it is in.

Move a symbol to another fileLink to this section

> move parseConfig from src/utils.ts to src/config/parser.ts

The agent moves the code and updates every import that used it. This works for TypeScript, JavaScript, Python, Rust, and Go.

Move or rename a fileLink to this section

> rename src/old-name.ts to src/utils/new-name.ts

The agent moves the file and updates every file that imports it.

Extract a function or variableLink to this section

> extract lines 42-58 of handler.ts into a function called validateInput

The selected code becomes a new function, with the parameters and return value it needs. You can extract an expression into a variable the same way.

Clean up importsLink to this section

> clean up imports in src/api.ts

Sorts imports, removes duplicates, and removes imports that are not used.

TipsLink to this section

  • Before a large rename, run /lsp status to check that a language server is running for your language. /lsp install adds one if it is missing.
  • If several symbols share the same name, mention the file so the agent changes the right one.
  • Empryo saves a checkpoint before each change. Press Ctrl+B to go back if you do not like the result.