We use cookies to improve your experience with our site.

CoEdPilot:全项⽬交互式代码编辑推荐⼯具

CoEdPilot: Interactively Recommending Project-Wise Code Edits

  • 摘要:
    研究背景 代码编辑是软件开发的核心活动,占所有提交操作的70%以上。目前如 GitHub Copilot等工具,虽可辅助单行代码生成,但难以支持现实场景中需要“逐步定位下一编辑点”的迭代性工作流。已有工作,如 GrACE 和 CCT5,多聚焦于编辑内容的生成,并假设编辑位置已知,缺乏对项目级、端到端的编辑推荐能力。
    目的 本研究旨在开发一个名为 CoEdPilot 的工具,支持项目范围内的交互式、迭代式代码编辑推荐。研究聚焦于两个关键问题:1)如何基于用户历史修改和自然语言意图准确预测后续编辑位置;2)如何结合用户反馈生成高质量的编辑建议,并支持连续多轮的修改过程。
    方法 CoEdPilot 被实现为一个 Visual Studio Code 插件,其框架如图1所示,包含三个核心模块。•后续(下次)编辑分析:通过两阶段定位器(文件级和行级)预测下一步修改的位置;•历史(先前)编辑分析:基于语义和语法相似度选取相关历史编辑,增强上下文理解,减少噪声干扰;•编辑生成模块:综合编辑意图与上下文,生成多个有置信排序的编辑候选方案,并通过用户的接收/修改操作不断优化推荐结果。这些模块背后的模型基于来自 471个开源项目的 18万条高质量提交记录进行微调。
    结果 模型评估显示,CoEdPilot 在多个任务上均表现优异:文件级编辑定位的准确率为 79.5%,召回率为 72.9%;行级定位准确率达 87.0%,召回率为 84.8%;编辑内容生成的 BLEU-4分数最高达 74.98,Top-10精确匹配率(EMR)可达 59.16%。这些结果表明,系统在定位编辑位置和生成建议方面均具有较强能力。用户研究邀请 18 位参与者进行对比实验,结果表明:在简单的 bug 修复任务中,CoEdPilot 与 Copilot 表现相近;在代码重构任务中略有优势(p= 0.07);而在需要多处修改的复杂特性添加任务中,CoEdPilot 显著优于 Copilot(p = 0.02,效应量为 0.80),表明其在复杂项目场景中更具实用性。
    结论 CoEdPilot 通过项目级分析与用户反馈迭代,支持端到端的交互式代码编辑流程,相较现有工具具有以下优势: • 支持跨文件的全项目范围分析,而非局限于当前文件; • 可通过自然语言描述输入用户意图; • 能根据用户行为持续学习与调整推荐结果。目前的局限包括响应延迟、冷启动时的意图误判,以及现有语言模型上下文处理能力不足。未来可通过结合静态分析工具、多模态意图对齐技术,以及“数字孪生”评估环境进一步提升系统性能与实用性。

     

    Abstract: Incremental code editing, as a fundamental task in software development, requires developers to iteratively identify edit locations and modify code. However, existing language model-driven approaches primarily focus on generating edit solutions for a single location, failing to provide comprehensive end-to-end solutions. To address this limitation and support real-world editing scenarios, we propose CoEdPilot, a project-wide interactive code editing recommendation tool. CoEdPilot utilizes edit descriptions and edit history, and recommends the next edit location with solutions across the entire project. It further refines its recommendations based on user editing feedback, enabling an end-to-end, iterative, and interactive editing process. We implement CoEdPilot as a visual studio code extension that monitors user actions, identifies subsequent editing locations, and generates edits throughout the project. Its functionality is powered by a set of back-end language models, which are trained on 180 000 high-quality commits from 471 open-source repositories. Extensive experiments demonstrate CoEdPilot's capabilities in accurately identifying editing locations (i.e., edit location predicted with an accuracy of 85.03%–88.99%) and generating high-quality edit solutions (i.e., generated edit content with a top-1 exact match rate (EMR) of 33.48%–48.94%). Our case study and user study of 18 participants further validate CoEdPilot's practicability.

     

/

返回文章
返回