Inline Completions: Tab Your Way Through Code
- Accept, dismiss, and cycle through inline completions using keyboard shortcuts
- Write comments and type signatures that produce accurate multi-line completions
- Explain how Next Edit Suggestions differs from standard ghost text completions
Ghost Text Is the Core Interaction
The most-used feature in GitHub Copilot is also its most invisible: ghost text. As you type, Copilot reads the code around your cursor — the function name, the surrounding file, the imports, the comments — and suggests what comes next. That suggestion appears as greyed-out text directly in your editor. Tab accepts it. Escape dismisses it. Nothing else required.
This is not search-based autocomplete. Copilot is not matching your prefix against a dictionary of known identifiers. It is generating code based on the full context of your file and, when available, related files in your workspace. The difference shows up immediately when you write a function that does something specific to your codebase — Copilot suggests implementations that match your patterns, not generic examples from the internet.
Key Keyboard Shortcuts
Cycling through suggestions with Alt+] and Alt+[ is valuable when the first suggestion is not what you want. Copilot keeps several alternatives ready. The second or third option often fits better, especially for function implementations where there are multiple valid approaches.
Multi-Line Completions
Copilot regularly suggests entire functions, classes, and blocks in a single ghost-text suggestion. This works best when you give it clear signals:
- Descriptive function names —
calculateMonthlyRevenuegenerates a more accurate suggestion thancalc - Type signatures — In TypeScript, adding parameter types and return types gives Copilot a precise spec to implement
- Comments before the function — A one-line comment like
// Returns the top 5 users by message count, sorted descendingacts as a specification Copilot implements directly - Test names — Writing
it('should return 404 when user does not exist', ...)prompts Copilot to write the test body
Next Edit Suggestions (NES)
Next Edit Suggestions is a newer inline feature that goes beyond completing the current line. It predicts where you are likely to make your next edit across related lines in the file and suggests that edit proactively.
A common example: you rename a parameter in a function signature. NES detects that the same variable is used three lines below and suggests updating those uses too, before you even move your cursor there. Accept each suggestion with Tab, and Copilot walks you through the chain of related changes.
NES appears as a subtle indicator at the beginning of the predicted edit line. It is separate from ghost text at your cursor position — you will see both kinds of suggestions at once as you work.
How Context Shapes Suggestions
Copilot uses several context sources when generating completions:
- The current file above and below the cursor
- Other open files in your editor tabs
- Related files Copilot detects based on imports
- File path and filename (a file named
auth.service.tsgets different suggestions thanutils.ts)
The practical implication: having relevant files open in tabs improves suggestions. If you are implementing a method that follows a pattern already used elsewhere in your codebase, open one of those files first. Copilot will pick up the pattern and apply it.
Try This
Open a code file in your project and write a comment describing a function you actually need: something like // Fetches all active subscriptions for a given user ID and returns them sorted by created_at descending. Then start the function signature on the next line and watch what Copilot suggests. Cycle through alternatives with Alt+] to see the range of implementations it offers.
- Tab accepts a ghost text suggestion; Alt+] and Alt+[ cycle through alternatives without dismissing the suggestion
- Descriptive function names, type signatures, and preceding comments all improve the accuracy of multi-line completions
- Next Edit Suggestions predicts and pre-suggests changes across related lines in the file — follow the chain with Tab