Omar AbedelKader, Stéphane Ducasse, Guillermo Polito, Oleksandr Zaitsev, Romain Robbes
Source code does not exist in isolation. Code is structured in project repositories composed of packages, and large applications are often composed of multiple projects. This paper investigates whether token-level completion engines can take advantage of such information. In this context, Pharo offers a sophisticated completion engine based on language semantics using heuristics , i.e., ordered sequences of lazy fetchers that retrieve and rank completion candidates. These heuristics can be recomposed or extended to support various activities ( e.g., live programming or history usage navigation). The default heuristics rely on the language’s semantics and scoping rules. While this system is powerful, it does not account for package concerns of any sort (neither repository structure nor package dependencies). As a result, it does not prioritize classes within the same package or project, nor the classes that they may use, treating all global names equally. In this paper, we introduce and systematically evaluate several new heuristics that address this limitation: Lateral Packages , Direct Package Dependencies , and Two-Level Package Dependencies heuristics. Our benchmark runs over the method call sites of 219 packages, comprising 4,535 classes and a total of 35,972 methods. This codebase covers major projects such as Iceberg, Moose, Roassal, Seaside, and Spec, ensuring a diverse and realistic benchmark for assessing the effectiveness of our proposed heuristics. We evaluate two key concerns: the completion of class and method names. Rather than proposing a new learning model, this work evaluates whether explicit package dependencies, already available in modular software systems, can serve as a lightweight structural signal for improving completion ranking. Results show that the Direct Package Dependencies heuristic improves Mean Reciprocal Rank (MRR): for 3-character prefixes, MRR increases from 0.20 to 0.44 for class-name completion and from 0.10 to 0.41 for method-name completion. These results indicate that package-aware completion strategies provide more accurate and relevant suggestions than the default Semantics-Based strategy in the evaluated projects. Because Direct Package Dependencies outperformed the default strategy for class-name completion, the Pharo Industrial Consortium decided to introduce it in Pharo 13.