arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2601.05617cs.SE
收藏

面向仓库的代码补全的包感知方法

Package-Aware Approach for Repository-Level Code Completion in Pharo

Univ. Lille, Inria, CNRS, Centrale Lille(里尔大学、法国国家信息与自动化研究所、法国国家科学研究中心、里尔中央理工学院);CNRS, University of Bordeaux, Bordeaux INP(法国国家科学研究中心、波尔多大学、波尔多国立理工学院)

Omar Abedelkader, Stéphane Ducasse, Oleksandr Zaitsev, Romain Robbes, Guillermo Polito

AI总结:

本文提出一种包感知的代码补全方法,通过优先考虑同一包内的类来提升补全准确性,实验表明其在MRR指标上优于传统方法。

摘要:

Pharo 提供了一个基于语义启发式的高级补全引擎,该引擎在懒惰架构中协调特定的获取器。这些启发式方法可以重新组合以支持各种活动(例如,实时编程或历史使用导航)。尽管该系统非常强大,但它在建议全局名称(如类名、类变量或全局变量)时并未考虑仓库结构。因此,它不优先考虑同一包或项目中的类,将所有全局名称视为同等重要。在本文中,我们提出了一种新的启发式方法来解决这一限制。我们的方法以结构化的方式搜索变量名称:首先从请求类的包开始,然后扩展到同一仓库中的其他包,最后考虑全局命名空间。我们描述了该启发式方法的逻辑,并将其与默认语义启发式方法和直接查询全局命名空间的方法进行评估。初步结果表明,平均倒数排名(MRR)有所提高,证实了包感知补全比之前的扁平全局方法能提供更准确和相关性的建议。

英文摘要:

Pharo offers a sophisticated completion engine based on semantic heuristics, which coordinates specific fetchers within a lazy architecture. These heuristics can be recomposed to support various activities (e.g., live programming or history usage navigation). While this system is powerful, it does not account for the repository structure when suggesting global names such as class names, class variables, or global variables. As a result, it does not prioritize classes within the same package or project, treating all global names equally. In this paper, we present a new heuristic that addresses this limitation. Our approach searches variable names in a structured manner: it begins with the package of the requesting class, then expands to other packages within the same repository, and finally considers the global namespace. We describe the logic behind this heuristic and evaluate it against the default semantic heuristic and one that directly queries the global namespace. Preliminary results indicate that the Mean Reciprocal Rank (MRR) improves, confirming that package-awareness completions deliver more accurate and relevant suggestions than the previous flat global approach.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑