Together We Go Further: LLMs and IDE Static Analysis for Extract Method Refactoring
Dorin Pomian, Abhiram Bellur, Malinda Dilhara, Zarina Kurbatova, Egor, Bogomolov, Timofey Bryksin, Danny Dig

TL;DR
This paper presents EM-Assist, a novel IntelliJ IDEA plugin that combines Large Language Models and static analysis to improve Extract Method refactoring, achieving higher accuracy and developer acceptance.
Contribution
It introduces a new approach that removes hallucinations from LLM suggestions, enhances and ranks them with static analysis, and integrates IDE execution, outperforming existing tools.
Findings
EM-Assist suggests the correct refactoring in 53.4% of cases.
It improves recall rate from 39.4% to 53.4%.
81.3% of industrial developers agreed with EM-Assist recommendations.
Abstract
Long methods that encapsulate multiple responsibilities within a single method are challenging to maintain. Choosing which statements to extract into new methods has been the target of many research tools. Despite steady improvements, these tools often fail to generate refactorings that align with developers' preferences and acceptance criteria. Given that Large Language Models (LLMs) have been trained on large code corpora, if we harness their familiarity with the way developers form functions, we could suggest refactorings that developers are likely to accept. In this paper, we advance the science and practice of refactoring by synergistically combining the insights of LLMs with the power of IDEs to perform Extract Method (EM). Our formative study on 1752 EM scenarios revealed that LLMs are very effective for giving expert suggestions, yet they are unreliable: up to 76.3% of the…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNatural Language Processing Techniques · Mathematics, Computing, and Information Processing
