You can prompt the agent from the code editor for code suggestions to modify, optimize, or add code to your app as follows:
- To get the prompt input field, from the code editor, highlight code that you want the agent to modify, right-click in the code editor, and select AI > Inline edit from the context menu (or press CTRL+\ on Windows or Command+\ on macOS).
- Prompt the agent by describing how you want to modify or add to your code and press Enter. After the agent processes your request, you should see a code diff. With the code diff, you can review and accept only the suggestions you want.
- Review the code diff and do one of the following:
- Further modify the suggested code by clicking Refine and entering a new prompt.
- Click Accept Changes to add the suggested changes to your code.
Things to try:
- "Simplify this code"
- "Make this code idiomatic"
- "Generate a new function that does <description>"
- "Add documentation for this code"