Code Completion

AI Assistant has the ability to insert LLM generated, context-aware code completion, while typing.

To generate relevant completions, the LLM request may include:

  • Contents of the current file

  • Type dependencies from other files

  • Recently opened files

To enable code completions:

  • Open VS Code Settings using Ctrl+, and check DVT ‣ AI ‣ Code Completion

  • Open Eclipse Preferences using Window ‣ Preferences and check DVT ‣ AI Assistant ‣ Insert “Show AI Assistant Code Completions …” in the ‘default’ content assist list

To trigger code completion in VS Code, start typing in the editor pausing briefly to wait for the inline suggestions to appear.

../../_images/ai-code-completion-vscode.png

In Eclipse, use the Content Assist Ctrl+Space and select Show AI Assistant Code Completions… to request code completions from the LLM. Once generated, one or more suggestions will be displayed.

../../_images/ai-code-completion-eclipse-1.png
../../_images/ai-code-completion-eclipse-2.png

Note

To customize the code completion prompt, run the DVT AI: Customize Code Completion Blueprint command and modify the generated blueprint.