Add Comments to Selected Element

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

To use this feature, place the cursor on a supported code element (e.g., module, interface, class, entity), then either:

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

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

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).

Previewing the HTML Output

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

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

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.