Add Comments to Selected Code

The Add Comment to the Selected Code predefined blueprint allows the insertion of LLM-generated, context-aware documentation into your code.

To use this feature, place the cursor on an element declaration (e.g., module, interface, class, entity) or select a piece of code, then either:

  • Right-click and choose AI Assistant ‣ Add Comment to the Selected Code, or

  • Use the command palette to run: DVT AI: Start Session from Blueprint ‣ Add Comment to the Selected Code

The response is shown in a side-by-side compare editor, highlighting the generated content.

Note

The generated comments use the same markup language set for the editor tooltips (e.g., Markdown, Javadoc, Natural Docs).

Customization

Use the command DVT AI: Edit Predefined Blueprint to modify the blueprint.

The blueprint sends a set of predefined comments as reference for the LLM using the @comments of element snippet.

To modify the default snippet run the command DVT AI: Edit Predefined Snippet.

This action will extract several files under the .dvt/ai/snippets/comment-examples directory.

Each file corresponds to a specific element type and supported markup language (e.g., module_markdown.example). You can directly modify the contents of these files with your own comments.

Previewing the HTML Output

You can preview the HTML version of your generated comments using Specador Live Preview.

../../../_images/specador_ai_assistant_preview.png