# hx\_StockComments

## Description

Manage the "stock comments" (creating, deleting, and editing), and apply them to the listing.

Hotkey: <kbd>A</kbd>

## What are Stock Comments?

**Stock comments** are repetitive comments that the user wishes to apply multiple times without re-typing them every time. For example, when reverse engineering C++ binaries, one expects to see the same inlined functions repeatedly: C++ binaries frequently create, destroy, and perform operations on `std::string` objects, and these operations are often inlined. It is useful to set comments on these inlined blocks to document their functionality and remind oneself that they have seen that code in the past, but the tedium of setting the same comments repeatedly can naturally dissuade the user from entering them. The Stock Comments feature is designed to address this tedium.

## Stock Comments dialog

When the user brings up the Stock Comments dialog in the pseudocode (either via its hotkey, or its right-click menu item), they are initially presented with an empty dialog. They can use the `Insert` shortcut (or right-click menu item) to create a new comment. They can also use the `Edit` shortcut to change existing entries, or the `Delete` shortcut to remove unwanted entries.

{% hint style="info" %}
Editing a comment, and then deleting the contents and saving, is treated the same as deleting the comment.
{% endhint %}

The user can use the arrow keys to select a stock comment, and press either `Enter` or `OK` to choose it. Once chosen, it will be applied as a block comment above the current construct in the pseudocode.

Upon choosing a selection, the comment will be moved to the top of the chooser dialog, such that it will be easy to select the next time they open the dialog. The most recently-used comments are always at the top, saving the user time in navigating to them, and adapting to their usage over time.

This functionality attempts to respond intelligently if it detects that the database storage for the stock comments has become corrupted. In that case, it will display a warning message, and then attempt to recover any existing stock comments, so the user should not lose many of their existing comments. (Hopefully, this will never happen.)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hex-rays.com/ida-actions/hx_stockcomments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
