Multi-line completion

You can get a multi-line code suggestion based on a line of code or a comment that you enter.

  1. Open your program in the editor.
  2. At the location where you want to insert new code, start typing a line of code, or enter a comment that describes the code you want.
  3. Use the keyboard shortcut:

    • For Mac: option + , (comma)
    • For Windows: Alt + , (comma)
  4. IBM® watsonx Code Assistant™ for Z adds a multi-line code suggestion either based on the code that you typed or the comment that you entered.

    Observe that the application uses the previous code in the program to set context for the code suggestions.

  5. Click Accept from the context menu to accept the entire code suggestion. Alternatively, click Accept Word from the context menu to accept the code suggestions word by word.

    In addition to hovering over suggestion for toolbar, you can use the following shortcut keys:

    • tab for full accept.
    • cmd + right arrow on Mac or ctrl + right arrow on Windows for partial word acceptance.

    You can always edit the code in the Editor even after accepting the entire suggestion.

  6. Press the esc key if you do not want to accept the code suggestion. Continue to type more code in the same line for improved code suggestions.
Note: If you are using comment to generate a multi-line code, then ensure that you have placed the cursor on the next line of the comment where no prior code lines exist. Otherwise, new code suggestions are not displayed.
Note: To view the context menu, hover over the code suggestion. The context menu is displayed. Use the ellipses menu to select the Always Show Toolbar option.