Refactor and format code
Refactorings change the structure of code without changing what it does: a new name everywhere it is used, a selected expression turned into a variable, a block into a method. Each one, across all the files it touches, is one step to undo. Rename, extract and inline: Works. The other refactorings: Experimental.

Real frames of the application · ferris-idea drive, then ferris-idea drive screenshot after each step (docs/site/scripts/record-tour.py) · v1.6.0 release build, 2026-12-04 · throwaway demo project, a small Python shop with Pyright as language server; theme Ferris IDEA Dark
Before you start
Section titled “Before you start”Most refactorings ask the language server of the file’s language for the edit, on the text as it is in the editor. Install the server the page of your language names. Which refactorings exist depends on the language:
| Language | Rename | Extract and inline | Also |
|---|---|---|---|
| Rust | rust-analyzer | rust-analyzer’s extract and inline actions | |
| Python | Pyright | Ferris IDEA’s own: Extract Variable, Extract Method, Extract Constant, Inline Variable | |
| Java | the Eclipse Java server | the server’s, including Extract Field and Introduce Parameter | Surround With… |
| JavaScript, TypeScript | typescript-language-server | the server’s; Ferris IDEA’s own Extract Variable where the server offers none | Extract Interface, Extract Superclass, Pull Members Up (Ferris IDEA’s own) |
| C, C++ | clangd | clangd’s extract actions, no Inline | |
| other languages | the language server, if it renames | what the language server offers |
Change Signature is Ferris IDEA’s own and works in Rust, Go, Python, Java, Kotlin, JavaScript, TypeScript, PHP, Ruby and the C-like languages. Move updates references through the server and Ferris IDEA’s own rewriting, as described below. Where a refactoring comes from the server, it is as complete as that server’s.
Rename
Section titled “Rename”- Put the caret on a name and press ⇧F6, or Refactor › Rename….
- A popup Rename ‘total’ and its usages to opens with the name selected. Type the new name.
- Keep or clear Search in comments and strings (on by default) and Search for text occurrences (off by default).
- ↩ renames. The status bar names the old and new name and how many files changed.
Open files change in their editors, unsaved; files that are not open are written to disk. Only the
project’s own sources are changed, never dependencies. Renaming a Java class in its own file renames
the file too. On a keyword, a literal or a built-in type Ferris IDEA answers Cannot rename this element: the caret should be on an identifier.
Extract and inline
Section titled “Extract and inline”- Select an expression, or put the caret in one. For Extract Method, select the statements.
- Choose Refactor › Extract/Introduce › Introduce Variable… (⌥⌘V, CtrlAltV), Introduce Constant… or Extract Method…. The editor’s context menu calls them Extract Variable… and Extract Constant….
- If there is one way to do it, it is done at once; with several (for example, which enclosing expression), the list of context actions opens to choose.
- The rename popup opens on the new name the server chose (
value,placeholder, …). Type yours and press ↩.
Refactor › Inline… (⌥⌘N, CtrlAltN) does the reverse: it replaces a variable, constant or method by its value or body at every use.
A server has 45 seconds to answer; after that the status bar says which refactoring failed and why.
Python’s own extraction refuses with the reason, such as
Cannot extract `x +` into a variable: ….
Refactor This
Section titled “Refactor This”Refactor › Refactor This… (⌃T on macOS, CtrlAltShiftT on Linux) lists every refactoring that can act at the caret, from the server and Ferris IDEA’s own, so you need not remember the keys.
Change Signature
Section titled “Change Signature”- Put the caret on a function’s declaration or a call and press ⌘F6 (CtrlF6), or Refactor › Change Signature….
- The parameter list opens as one line of text. Reorder, rename, remove or add parameters. A new
parameter needs a value for the existing calls:
rate: float = 0.1. - ↩ changes the declaration and every call.
Calls that do not fit the old signature, such as calls with unpacked arguments, are listed and left as they are, rather than changed wrongly. Overriding methods are not followed.
Move, copy and safe delete
Section titled “Move, copy and safe delete”- Refactor › Move… (F6) moves the active file, or the files selected in the Project
tool window, to a folder you type. References are updated: by the language server (Rust modules,
Java packages, TypeScript imports) and by Ferris IDEA for relative C and C++
#includelines, JavaScript and TypeScript imports, Rust#[path]attributes, and thepackageline of Java and Kotlin. Save the file first; an unsaved file is not moved. - Refactor › Copy… (F5) copies a file.
- Refactor › Safe Delete… (⌘⌦, AltDelete) first
searches for usages. With none, it deletes the declaration with its comments and annotations;
with some, it lists them (Safe Delete
name: 3 usages) and you choose Delete anyway or Cancel.
Undo a refactoring
Section titled “Undo a refactoring”A refactoring is one undo step named after it, such as Rename helper to calc, across every file
it changed. Press ⌘Z in any of those files and all of them go back; the status
bar says Undone: Rename helper to calc.
If one of the files was changed after the refactoring, undo is refused and says which file, rather
than mixing the two changes: undo that later change first, or restore the file from
local history, where every refactoring leaves a labelled entry
(Before Rename helper to calc). The 20 newest refactorings can be undone.
Reformat code and imports
Section titled “Reformat code and imports”| Command | Menu | What it does |
|---|---|---|
| Reformat Code | Code › Reformat Code | formats the selection, or the whole file |
| Reformat File | Code › Reformat File… | asks first: Selected text only, Only changed lines (Git), Optimize imports |
| Optimize Imports | Code › Optimize Imports | removes unused and duplicate imports and sorts them |
| Reformat with Prettier | Code › Reformat with Prettier | runs the project’s Prettier |
| Fix ESLint Problems | Code › Fix ESLint Problems | applies the project’s ESLint fixes |
Ferris IDEA has no code style engine of its own; it runs the formatter that belongs to the language, so the result matches what your build and CI produce:
- Rust, Go, C and C++, TOML, YAML and others: the language server’s formatter (rustfmt through rust-analyzer, gopls, clang-format through clangd, taplo).
- JavaScript, TypeScript, CSS and others: Prettier from the project, in a trusted project that has it; otherwise the language server.
- Python: the project’s
rufforblack. Ferris IDEA installs neither; without them, the status bar says so. - SQL and Markdown (without Prettier): Ferris IDEA’s own formatter, whole files only.
Indentation, tab width, trailing whitespace and the final newline follow the project’s
.editorconfig (Settings). Optimize Imports works in
Java and Kotlin (by Ferris IDEA), Python (ruff or the server), and JavaScript, TypeScript, Vue and
Svelte (the server). The result is one undo step and says what happened: Already formatted.,
Removed 1 import.
Shortcuts
Section titled “Shortcuts”| Action | Shortcut |
|---|---|
| Code › Optimize Imports | ⌃⌥OCtrlAltO |
| Code › Reformat Code | ⌥⌘LCtrlAltL |
| Code › Reformat File | ⌥⇧⌘LCtrlShiftAltL |
| Edit › Redo | ⇧⌘Z or ⌥⇧⌫CtrlShiftZ or AltShiftBackspace |
| Edit › Undo | ⌘ZCtrlZ or AltBackspace |
| Refactor › Change Signature | ⌘F6CtrlF6 |
| Refactor › Copy | F5F5 |
| Refactor › Extract/Introduce › Extract Constant | ⌥⌘CCtrlAltC |
| Refactor › Extract/Introduce › Extract Field | ⌥⌘FCtrlAltF |
| Refactor › Extract/Introduce › Extract Method | ⌥⌘MCtrlAltM |
| Refactor › Extract/Introduce › Extract Variable | ⌥⌘VCtrlAltV |
| Refactor › Extract/Introduce › Introduce Parameter | ⌥⌘PCtrlAltP |
| Refactor › Inline | ⌥⌘NCtrlAltN |
| Refactor › Move | F6F6 |
| Refactor › Refactor This | ⌃Tno shortcut |
| Refactor › Rename | ⇧F6ShiftF6 |
| Refactor › Safe Delete | ⌘⌦AltDelete |
When it does not work
Section titled “When it does not work”- Nothing happens. The language server offers no such action at this place. Select the exact expression, or check the table above for your language.
… failed: …: no answer within 45 s. The server is busy indexing; try again when the status bar shows it ready.No ruff or black found …. Install one of them into the project’s virtual environment or on yourPATH.- Undo refused. A file of the refactoring changed after it. Undo that change first, or use local history.
For agents
Section titled “For agents”Every refactoring is a tool with a dry run that returns the edits per file. Applying needs write;
formatting with a project’s own tool also needs a trusted project.
apply_code_actionApply a quick fix or refactoring offered by code_actions, chosen by title.change_signatureChange Signature of the function at a position of a workspace file: reorder, rename, remove or add parameters, and rewrite its declarations and every call to match.code_actionsQuick fixes and refactorings the file's language server offers at a position or selection: title, kind, preferred and the problems each fixes.editorconfigEditorConfig properties of a workspace file as the editor applies them: the.editorconfigfiles read (from the file's folder up to one withroot = true), every property with the file and line that set it, the indentation unit, tab width, line break, whether saving trims trailing whitespace and adds or removes the final line break, max_line_length, charset, and values that are not understood.extract_interfaceExtract Interface for the class at (or around) a position of a TypeScript file: creates the interface before the type with the signatures ofmembersand adds it toimplements(orextendsof an interface).extract_superclassExtract Superclass for the class at (or around) a position of a JavaScript or TypeScript file: createsclass namebefore it with the chosenmembers, moves them there and makes the class extend it.format_fileFormat a workspace file (or arange) as Reformat Code does.move_fileMove workspace files or folders into another folder and update references: language-server edits (Rust modules, Java packages, TypeScript imports) plus Ferris IDEA's rewriting of relative C/C++ includes and JS/TS imports, also in the moved file.optimize_importsOptimize Imports.prettier_fileFormat a file with the project's own Prettier (node_modules/.bin/prettierin or above its package, inside the workspace, with the project's configuration; nothing is downloaded).pull_members_upPull Members Up for the class at (or around) a position of a JavaScript or TypeScript file: movesmembersto the end of the direct supertype namedtarget(may be left out when there is only one), or adds their signature when it is an interface orabstractis true (an abstract class).redo_refactoringRedo the refactoring undo_refactoring took back last, in all files it changed at once, as ⇧⌘Z does in an editor.rename_symbolRename the symbol at a position of a workspace file in all its usages, through the file's language server.safe_deleteSafe Delete of the symbol at a position of a workspace file: finds usages as find_usages does and removes the declaration's whole lines with the comment, doc and annotation lines above it.undo_refactoringUndo the newest refactoring applied through this server with rename_symbol or apply_code_action (dry_run=false), in all files it changed at once.
No tool matches. Try fewer words, or .




