AI Code Completion

Share

What is AI Code Completion?

AI code completion is a feature of some AI-based software for software development that leverages large language models (LLM's) in order to generate code inside a source code editor or IDE.

Compared to traditional code completion, AI code completion can provide AI-generated code that fits the intent of a specific section of source code based on the semantics of the names found in a given scope. A simple example is that if you have two objects, e.g. horizontalFooand verticalFoo, and you write some code using horizontalFoo and horizontal axis variable and field names like left, right, x, the LLM-based code completer can predict that, when you start writing code for verticalFoo, you would write the exact same code except with vertical axis-related names instead, such as top, bottom, and y. This grouping of semantics is something that LLM's excel at and that traditional algorithms would struggle to perform generally. On the other hand, AI code completion can feel intrusive, as the LLM-based code completer can predict some possible line of code that you might write for every single line of code, even when it's something that the LLM couldn't possibly help you with, e.g. creating a new class or function to do something completely new in a project.

An animated image displaying an example of Copilot's code completion in action. After // Instantiate a ball object is typed, Copilot guesses what is the next line of code that should be written: let ball = ball::Ball::new..., and adding this line takes only a single key press.
A recording of Copilot's code completion in action. After manually typing a code comment, Copilot guesses what the next line of code should be an displays it in the editor. Pressing the Tab key inserts the Copilot's code.
Written by Noel Santos.

About the Author

I'm a self-taught Brazilian programmer graduated in IT from a FATEC. In a world of increasingly complex and essential computers, I decided to use my technical expertise in hardware, desktop applications, and web technologies to create an informative resource to make PC's easier to understand.

View Comments