arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2609.20279cs.SE

评估 Pharo 中仓库级代码补全的包级作用域策略

Evaluating Package-Level Scoping Strategies for Repository-Level Code Completion in Pharo

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

首次发表
浏览论文内容

中文总结 AI 辅助

针对仓库级代码补全忽略包结构的问题,提出三种包感知启发式策略,其中直接包依赖显著提升类名和方法名补全的MRR,并被Pharo 13采用。

中文摘要 AI 辅助

源代码按仓库、包和项目组织,然而基于词元的补全引擎很少利用这种结构。Pharo 提供了一种基于有序、惰性启发式方法的语义补全引擎,用于检索和排序候选。其默认策略遵循语言语义和作用域规则,但忽略了包结构和依赖关系。因此,来自同一包或项目的类,以及被它们使用的类,得不到特殊优先级。我们引入并评估了三种包感知启发式方法:横向包(Lateral Packages)、直接包依赖(Direct Package Dependencies)和两级包依赖(Two-Level Package Dependencies)。我们的基准覆盖了来自219个包的方法调用点,包括Iceberg、Moose、Roassal、Seaside和Spec等主要Pharo项目中的4,535个类和35,972个方法。我们评估了类名和方法名补全,并询问显式包依赖是否能提供一种轻量级的结构信号,以改进候选排序而无需引入新的学习模型。直接包依赖启发式方法产生了最强结果。对于3字符前缀,类名补全的平均倒数排名(Mean Reciprocal Rank)从0.20增加到0.44,方法名补全从0.10增加到0.41。这些发现表明,在评估的项目上,包感知策略比默认的基于语义的策略提供了更准确和相关的建议。基于类名补全的改进,Pharo工业联盟在Pharo 13中采用了直接包依赖启发式方法。

英文摘要

Source code is organized in repositories, packages, and projects, yet token-level completion engines rarely exploit this structure. Pharo provides a semantic completion engine based on ordered, lazy heuristics that retrieve and rank candidates. Its default strategy follows language semantics and scoping rules, but ignores package structure and dependencies. Consequently, classes from the same package or project, and classes used by them, receive no special priority. We introduce and evaluate three package-aware heuristics: Lateral Packages, Direct Package Dependencies, and Two-Level Package Dependencies. Our benchmark covers method call sites from 219 packages, including 4,535 classes and 35,972 methods across major Pharo projects such as Iceberg, Moose, Roassal, Seaside, and Spec. We assess class-name and method-name completion and ask whether explicit package dependencies can provide a lightweight structural signal for improving candidate ranking without introducing a new learning model. The Direct Package Dependencies heuristic produced the strongest results. For 3-character prefixes, Mean Reciprocal Rank increased from 0.20 to 0.44 for class-name completion and from 0.10 to 0.41 for method-name completion. These findings show that package-aware strategies provide more accurate and relevant suggestions than the default Semantics-Based strategy on the evaluated projects. Based on the improvement in class-name completion, the Pharo Industrial Consortium adopted the Direct Package Dependencies heuristic for Pharo 13.

发表机构

  • Univ. Lille, Inria, CNRS, Centrale Lille, UMR 9189 CRIStAL(里尔大学、法国国家信息与自动化研究所、法国国家科学研究中心、中央里尔学院、CRIStAL实验室)
  • CIRAD, UMR SENS(法国农业研究国际合作中心)
  • CNRS, University of Bordeaux, Bordeaux INP, LaBRI, UMR5800(法国国家科学研究中心、波尔多大学、波尔多理工学院、LaBRI实验室)

机构由 AI 辅助整理,请以论文原文为准。

↑