Improving Code Completion @ GSoC 2019: introduction

Yup. I have been lucky enough to get into the Google Summer of Code (GSoC for short) programme again, and I am really excited. It’s been 1.5 weeks since the results were announced, and six other students and myself have already started work on their projects as part of the community bonding period, where everyone gets to know their projects, mentors and the general community better.

The overall expectation is that each of us will be publishing more or less weekly blogs throughout the programme, reporting the progress we’ve made with our work or even simply taking note of things in Pharo that we found exciting or worthy of writing about. Hence, this is my first post for GSoC 2019 and in it I will tell you more about my project, myself, as well as provide some useful links if you are interested in Pharo, following my project, or both. I must say, I’m also grateful for this excuse to write regularly ;)

So, this summer I am continuing my work on… yes, it’s in the title… code completion! Last summer during my internship at INRIA Lille I started working on improving the old completion, which would, my supervisors and I almost immediately decided, consist of creating another completion tool from scratch (why and how can be read here). If you are interested in finding out about the existing code completion in Pharo in general, I looked at it here (unfortunately, I never got around to writing an official part 2).

btw this is my completion being used !!!

Okay, so now a brief summary of the things that were done last summer:

  • developing a completion engine that uses AST (abstract syntax tree) nodes information to complete strings it receives; it works but can be improved
  • creating a matcher that uses a visitor to collect all the fitting completion options based on different conditions (i.e. whether it’s a literal, message or variable node)
  • starting work on the sorter that would only propose completion suggestions in a certain order (so far, alphabetical and reverse-alphabetical)
  • implementing a fairly extensive testing functionality to test the tool
  • starting to port the tool inside the Pharo programming environment

Now the things that I plan on doing during GSoC:

  • (1) testing and CI — rewriting / writing more tests and setting up the CI to make sure that everything that is already implemented works 100%, as well as write new tests for the functionality to be added during GSoC, as per the TDD approach.
  • (2) porting the engine — fully port completion engine inside Pharo. It has already been made possible to enable our completion controller in the settings, but most of the functionality has been borrowed from the existing completion models just for testing, and so it will have to be rewritten / greatly improved. There are also some challenges in making our code completion work for both the playground and the editor, because those functionalities and how our completion engine behaves in them have to be addressed separately. This will also be done as part of this step.
  • (3) statistical sorting — extend the sorter functionality by implementing several more sorting strategies, i.e. sorting by recently modified methods and by the hierarchically closer methods (first methods of the class are displayed, then the superclass, etc).
  • (4) improving completion engine — implementing additional features in order to enhance the code completion even further (e.g. support for code in braces, incorrect punctuation, etc).
  • (5) type inference — right now we only do limited type inference, i.e. we can only tell the type when there’s an assignment in a method with a known type. The solution would be to implement a visitor that annotates the AST with type information, as well as make type inference pluggable so that better implementations can be added later.

To sum up, the aim of this project is to have:

  • a code completion engine that performs better than the existing one
  • a well-tested and well-documented completion tool that can be scaled if needed

and if you are interested to follow my GSoC journey, learn more about Pharo, stay in touch or give me some suggestions regarding the project, of course, there’s this blog, my twitter, the mailing list, and the Pharo discord server (where I should be searchable by MyroslavaR#8495).

P.S. I’m also hoping to put together a little guide (maybe a series of posts or one bigger post) that will serve as a guide for Pharo newbies, especially some workarounds to common issues that might be well-known to experienced users and hence are not described anywhere, but might be a deal breaker for someone who is just getting started with Pharo. Especially on Windows, since it’s the most problematic (yes, this time around I’m back to working on Windows and there has already been some resistance from Iceberg ;)). SO! If you know some persistent problems and maybe even some workarounds to them, please contact me and together we will save someone hours of frustration! And yes, in the following days I plan to look through the mailing list and discord in search of something like that and credit you, if you provided solutions I will use.

Here’s to a productive summer and I’ll see you all soon,
M