Assembler Code Explanation
Code Explanation is available in two types: chat experience and code selection. By using the chat
experience
feature, seamlessly engage in a conversation with AI, getting quick and accurate answers to questions about
code.
Getting started with Assembler Explanation on VS Code
You can generate an explanation for the selected Assembler source code. A split editor panel opens on the right of the VS Code window to display the code explanation, which provides the business purpose, the inputs, outputs, and key data records, as well as a detailed functional summary of code function.
- On the VS Code window, in the explorer panel, left-click on a Assembler file to open it in the editor panel.
- Select and right-click on the portion of Assembler code that you want to generate an explanation for.
- Hover over watsonx Code Assistant™ for Z to open the menu.
- Select any one of the explanation types: Simple or Detailed.
For code explanation examples, see Assembler Code Explanation examples topic.
Generate and insert comments
2.7.0+ You can generate and add code comments for a
selected Assembler file by using the
Document
Code Lens or by using the /document
command.
If the AI Chat
option in VS Code extension settings
is disabled, the output is displayed in the side panel. If the AI Chat
option is enabled, the
output is displayed in a chat window.
- On the VS Code window, in the explorer panel, left-click a Assembler file to open it in the editor panel.
- Click Document on the top of the file. If the
AI Chat
option in VS Code extension settings is disabled, the Code Explanation side panel opens to the right and displays the output for the selected file. - In the panel view, click the icon labeled Insert as comment to insert the code comments in the source file.
Using the Chat Experience feature
2.8.0+To generate explanation through watsonx Code Assistant for Z Chat, see Using watsonx Code Assistant for Z Agentic chat IDE.
(2.7.20+ or earlier) To generate explanation through Chat, do the following:
- Click the watsonx
Code Assistant extension on the side panel to open
the
Chat Experience
feature. - Type /explain, press the space button, and then type @. A menu with a list of files opens in the VS Code workspace.
- Select the program and press Enter. Code Explanation for the selected file is displayed in the chat window. You can type in follow-on questions in the chat area to seek further responses.
Alternatively with the code open in the VS Code workspace, right-click the code snippet, and select Generate Detailed Explanation to view code explanation in the chat window. Follow-on questions are not supported for this method.
Working with code comments by using Document Code Lens
2.7.0+ To generate and insert
comments for a selected file by using the Chat Experience
feature, complete the steps mentioned for Document
Code Lens procedure. However, make sure that the AI
Chat
option is enabled in VS Code extension settings.
The watsonx Code Assistant chat window opens to the left and displays code comments for the complete file. Click the Insert icon to insert comments in the source file.
Working with code comments by using /document command
/document command, complete these steps.- Click the watsonx
Code Assistant extension on the side panel to open
the
Chat Experience
feature.Make sure that the AI Chat option is enabled within the watsonx Code Assistant for Z extension.
- Enter /document and then enter @. A menu with a list of files opens in the VS Code workspace.
- Choose the required file.
After a few seconds, watsonx Code Assistant generates separate comments for the selected file in the chat window.
- In the chat response, click the Insert icon to insert the comments in the source file.
Getting started with Assembler Explanation on Eclipse
With IBM® Developer for z/OS® or z/OS Explorer, you can generate explanations for full Assembler files from the Project Explorer and z/OS Explorer views in Eclipse IDEs.
The code explanation procedure for VS Code and Eclipse environments is similar.