Completions
Code completions are text suggestions that appear inline as you type in an editor. These suggestions can be lines or blocks of code based on the context of what you’re writing. Other names for code completions include inline suggestions, ghost text, or inline completions.
Completions are powered by Posit AI or GitHub Copilot. Ensure you’ve added one or both of these as a language model provider:
Using code completions
When code completions are available, ghost text appears in your editor as you type. The ghost text represents the suggested completion.
Interact with suggestions by:
- Pressing the TabTab key to accept the entire suggestion.
- Pressing to accept the suggestion word-by-word for a single-line suggestion, or line-by-line for multi-line suggestions.
- Pressing EscEsc or continuing to type to dismiss the suggestion.
Commands
The following commands apply to both providers:
| Command | Description |
|---|---|
| Snooze Inline Suggestions | Pause inline suggestions temporarily for a specified duration. |
| Cancel Snooze Inline Suggestions | Resume inline suggestions immediately if they have been snoozed. |
Posit AI Next Edit Suggestions (NES)
When using Posit AI as your completions provider, code completions take the form of Posit AI Next Edit Suggestions (NES), a preview feature. Rather than only suggesting text at the cursor position, Posit AI NES proposes edits anywhere in the file based on the changes you’ve recently made, including insertions, deletions, and modifications to existing code.
Posit AI NES suggestions appear inline in the editor. You can accept, navigate, or dismiss them using the same keybindings as other code completions.
Enable
Posit AI NES is enabled by default once you’ve signed in to the Posit AI provider. No additional setting changes are required.
Restrict to specific languages
Posit AI NES skips plaintext, markdown, and scminput unless you configure otherwise. Use the nextEditSuggestions.enable setting to change which languages Posit AI NES applies to.
Disable
To disable Posit AI NES, do any of the following:
- Sign out of Posit AI in Positron via the Accounts menu or the Accounts: Manage Accounts command. This also affects chat and other features that rely on the account.
- Set
nextEditSuggestions.enableto{ "*": false }to disable Posit AI NES everywhere. To disable only some languages, set those entries tofalse.
To exclude specific files from Posit AI NES regardless of language, use the shared aiExcludes setting.
GitHub Copilot
When using GitHub Copilot as your completions provider, code completions appear as ghost text at the cursor position as you type. To learn more, visit the GitHub Copilot inline suggestions documentation.
Enable
GitHub Copilot completions are enabled by default once you’ve signed in to the GitHub Copilot provider. No additional setting changes are required.
Restrict to specific languages
GitHub Copilot completions skip plaintext, markdown, and scminput unless you configure otherwise. Use the positron.assistant.inlineCompletions.enable setting to change which languages Copilot completions apply to.
Disable
To disable GitHub Copilot completions, do any of the following:
- Sign out of GitHub in Positron via the Accounts menu or the Accounts: Manage Accounts command. This also affects chat and other features that rely on the account.
- Run the Positron Assistant: Toggle (Enable/Disable) Completions command to toggle Copilot completions for the current language. This command updates
positron.assistant.inlineCompletions.enablefor the active language. - Set
positron.assistant.inlineCompletions.enableto{ "*": false }to disable Copilot completions everywhere. To disable only some languages, set those entries tofalse. - Set
github.copilot.enableto disable completions at the upstream GitHub Copilot extension level.
To exclude specific files from Copilot completions regardless of language, use the shared aiExcludes setting.
Status bar icon
The Assistant status bar icon indicates the current state of GitHub Copilot completions.
To manage Copilot completions using the status bar icon:
- Select the status bar icon to open the menu.
- From the menu, enable or disable completions for the current file type or for all files, or view the remaining time for snoozed completions.
Troubleshooting
If you are not receiving suggestions:
- Confirm you are signed in to your completions provider in the language model provider configuration.
- Check that your completions provider’s per-language settings do not disable the current language (see Posit AI Next Edit Suggestions or GitHub Copilot).
- Check that
positron.assistant.aiExcludesdoes not match the current file. - Refer to the Troubleshooting guide for more help.
