Skip to main content

Inline Code Completions

GitHub Copilot's AI generated code completions (aka code suggestions) is one of the most effective applications of AI technology at this time. In this guide we walk through the mechanics of requesting and handling of Copilot code completions.

1. Code Suggestions Process

The inline code completions generation process consist of the following steps:

  1. Copilot4Eclipse uses the context of your current editor along with that of nearby open editors to request code suggestions over a TLS encrypted connection from GitHub Copilot.
  2. Code suggestions generated by GitHub Copilot are returned to Copilot4Eclipse where they are displayed as "ghost-text" at the editor's cursor location. GitHub Copilot typically returns 0-2 completions per request. When multiple completions are returned, the 1st completion in the result set is shown by default. Menu actions such as "Show Next Completion" and keyboard shortcuts are available for sequentually viewing other completions in the result.
  3. You choose to accept or dismiss the code completion. An accepted completion inserts the completion text into the document at the cursor location. Dismissing a completion causes the completion ghost-text to be cleared from display.

2. Inline Completion "Ghost-Text"

Ghost-text styled inline code completions are rendered ephemerally within the editor immeditately to the right of the cursor. The default styling of ghost-text completions is a light gray italic font similar to that shown below. The color and italic styling of inline completions text can be customized in the Copilot4Eclipse Preferences.

3. Automatically Showing Completions

Copilot4Eclipse is configured to automatically trigger completion requests as you type. The round-trip process from completion request to the rendering of generated code completions as ghost-text happens fast, typically within a few hundred milliseconds after you stop typing.

This real-time behavior can be disabled from the Copilot4Eclipse Preferences.

4. Manually Requesting Code Completions

When working within an Eclipse editor for which Copilot4Eclipse is active, code completions can be manually requested. Use either the Copilot menu > Show completion action or the "Show an inline completion" keyboard shortcut.

5. Visually Identify Code Completion Activity

Copilot4Eclipse completion generation activity can be viewed in the Eclipse statusbar. During the request process the Copilot gen... message is shown in the statusbar along with a small visual progress indicator.

6. Simultaneous Inline Completion and Eclipse Content Assist

Copilot4Eclipse supports the simultaneous display of inline Copilot code completions and the Eclipse Content Assist Dialog. When in this mode, use the Tab and ESC keys to accept or reject the Copilot completion. The Enter key will accept the current Eclipse code completion.

The Copilot4Eclipse preferences includes the "Disable auto activation of Eclipse content assist" setting for overriding when automatic triggering of Eclipse content assist occurs.

7. Working with a Multiple Completion

GitHub Copilot typically generates between 0-3 code completions per completion result. The completions within a completion-request are number from 1 to n.

The Copilot4Eclipse statusbar displays the number of completions available as well as the index of the currently displayed completion. In the following example, the first of 2 completions is being displayed.

Use the Copilot menu actions Next Completion and Previous Completion or the equivalent keyboard shortcut to cycle through the available completions.

When no completions are available the Statusbar information will display an asterisk *.

8. Disable Completions Globally or Per Language

Copilot completion generation can be disabled either globally for all programming languages or only the programming language of the current editor. Both Copilot menus include actions for disabling completions.

  • Choosing Disable Completions will disable Copilot completion generation in all Eclipse editors.
  • Choose Disable Completions For <language> will disabled Copilot completion generation for all editors of that particular programming language.

The following Statusbar image and lack of completion status text indicates that Copilot4Eclipse is disable for your current editor.

9. Enable Copilot Completion Generation

When Copilot completion generation has been disabled either globally or for the programming language of the current editor, choose the Copilot menu > Enable Completions action to resume completion generation.

10. Working with Language Identifiers

GitHub Copilot AI is trained on the most popular programming languages. Each supported programming language has a langugae identifier, (aka languageId). GitHub Copilot uses the languageId as part of the context when generating code suggestions. Thus for accurate code suggestions it is important to detect the proper languageId for each Eclipse editor that Copilot4EClipse supports.

Copilot4Eclipse use a file-naming pattern to match a languageId to an editor. Learn more about languageIds, enabling and disabling programming language support and how to custom a languageId here.


When no languageId can be detected for an editor, the PlainText language is used as the default.

11. Code Completion Keyboard Shortcuts

Show an inline completionALT + \
Show next inline completionALT + ]
Show previous inline completionALT + [
Accept inline completionTAB
Accept Completion - Next WordCTL + RIGHT_ARROW
Accept Completion - End of LineCTL + ALT + RIGHT_ARROW
Dismiss CompletionESC