Using AI tools

AI code completion

In short

AI code completion is a coding tool suggesting the next line, or a whole block of code, as you type. You accept it with a keypress, or you keep typing and the suggestion disappears.

Also called
AI autocomplete, Inline code suggestions, Copilot inline suggestions
Topic
Using AI tools
Level
Beginner
First described
Alexey Svyatkovskiy, Ying Zhao, Shengyu Fu and Neel Sundaresan at Microsoft, in "Pythia: AI-assisted Code Completion System", presented at KDD 20191.

Editors have long finished a name you already used in the file, from a fixed list. AI code completion guesses code you have not written. Microsoft researchers described an early system, Pythia, in a paper for the 2019 KDD conference. It ranked method and API suggestions as you edited, using a neural network trained on the structure of Python code, and it shipped in the Intellicode extension for Visual Studio Code. On 2,700 public Python repositories, the right suggestion was in its top five 92% of the time1.

The version most programmers met was GitHub Copilot. On 29 June 2021 GitHub launched a technical preview it called an AI pair programmer. As you type, it suggests whole lines or entire functions from the code around the cursor. GitHub said it was powered by OpenAI Codex, trained with a much larger share of public source code than GPT-3, and that the preview was strongest in Python, JavaScript, TypeScript, Ruby and Go2. The Codex paper, posted that July, says a production version of Codex powers Copilot. On a test of writing Python from a written description, Codex solved 28.8% of tasks in one sample. GPT-3 solved none of them3.

GitHub's current docs describe the same loop, now called inline suggestions. The editor sends the code around the cursor, plus snippets from other open files, to a large language model. The suggestion shows as text you have not accepted yet. The file changes only if you accept it. You can take part of a suggestion, dismiss it, or ignore it by typing on. A comment in ordinary language, such as "use recursion", can steer what it proposes4.

GitHub says the suggestion can be wrong, insecure, or a close match to public code, and that you should review and test it before you rely on it. A setting can block matches to public code or show the repository and the licence. Quality also depends on the language: JavaScript is well represented in public repositories and is one of the best supported, while languages with less public code are harder to help with4.

Example

GitHub's docs use a comment as the prompt. You type "use recursion" above the code you are writing, and the inline suggestion proposes an implementation that follows that comment. Nothing is saved into the file until you accept it4.

Why it matters

It is the AI feature many programmers meet first, inside the editor they already have open. A suggestion that looks finished can still be wrong, so the useful habit is to read it before accepting4.

Questions people ask

Is AI code completion the same as GitHub Copilot?

Copilot is one product that does it, not the whole idea. Its inline suggestions are the completion part: proposed code appears as you type, and the file changes only if you accept it4. The preview that launched this style of product was announced by GitHub on 29 June 20212.

Does it work in every programming language?

GitHub says inline suggestions support many languages, but quality depends on how much of that language was in the training data. JavaScript is one of the best supported because public repositories contain a lot of it. Languages with less public code are harder to assist4.

Can it copy someone else's code?

It can. GitHub says a match to public code is unlikely but possible, because the models were trained on public code. You can set Copilot to block those suggestions or to show the repository and its licence4.

Should I accept every suggestion?

No. GitHub says you should review and test suggestions. They can be syntactically wrong, miss what you meant, or be insecure. The suggestion stays visually separate from your code until you accept it4.

Related terms

Tools that use it

Sources

  1. Svyatkovskiy, Zhao, Fu and Sundaresan (2019), Pythia: AI-assisted Code Completion System, KDD 2019, arXiv:1912.00742
  2. Nat Friedman, GitHub Blog (29 June 2021), Introducing GitHub Copilot: your AI pair programmer
  3. Chen et al. (2021), Evaluating Large Language Models Trained on Code, arXiv:2107.03374
  4. GitHub Docs, Responsible use of GitHub Copilot inline suggestions (page read 12 October 2026)

Back to the glossary