What is code completion?

Definition

Completion tools offer possible continuations while a developer writes code. Suggestions can range from a name or expression to several lines, and may be based on static program information or learned patterns.

A plausible suggestion is not proof of correctness. Developers still need to check whether it matches the intended behavior and surrounding interfaces. Completion also differs from an agent independently editing files and running tests across a repository.

ELI5

Code completion helps finish something you have started writing. It can save typing, but you still decide whether the suggestion belongs in your program.

For example, when you begin calling a function, an editor may suggest its full name and expected inputs. An AI tool might suggest the next several lines too, but those lines can still contain a mistake.

Does all code completion use AI?

No. Editors can also use known names, types and language rules to suggest completions without a generative model.

How is completion different from a coding agent?

Completion typically suggests code at the current editing point. A coding agent may inspect a repository, change multiple files and run validation tools.

  1. Daksh Gupta in a blue top on the left, resting his hand under his chin, beside the blue and white headline AI VS HUMAN CODE on black.
Definition card for code completion: What is code completion?

Code completion suggests how to continue a piece of software code, using nearby context, program structure or an AI model.