packages/kilo-docs/pages/code-with-ai/features/code-actions.md
Code Actions are a powerful feature of VS Code that provide quick fixes, refactorings, and other code-related suggestions directly within the editor. Kilo Code integrates with this system to offer AI-powered assistance for common coding tasks.
{% callout type="info" %} Code Actions are a VS Code extension feature and are not available in the CLI/TUI. {% /callout %}
{% tabs %} {% tab label="VSCode" %}
The extension provides code actions via the editor context menu and lightbulb:
Cmd+K Cmd+A (Mac) or Ctrl+K Ctrl+A (Windows/Linux).If the Agent Manager is active, code actions route to the current Agent Manager session rather than the sidebar chat. This allows code actions to work seamlessly within multi-session workflows.
The extension also adds code actions to the terminal context menu:
{% /tab %} {% tab label="VSCode (Legacy)" %}
Code Actions appear as a lightbulb icon (💡) in the editor gutter (the area to the left of the line numbers). They can also be accessed via the right-click context menu, or via keyboard shortcut. They are triggered when:
Clicking the lightbulb, right-clicking and selecting "Kilo Code", or using the keyboard shortcut (Ctrl+. or Cmd+. on macOS, by default), displays a menu of available actions.
{% image src="/docs/img/code-actions/code-actions-1.png" alt="VS Code code actions in line with code" width="500" /%}
Kilo Code provides the following Code Actions:
The Add to Context action is listed first in the Code Actions menu so you can quickly add code snippets to your conversation. When you use it, Kilo Code includes the filename and line numbers along with the code.
This helps Kilo understand the exact context of your code within the project, allowing it to provide more relevant and accurate assistance.
{% image src="/docs/img/code-actions/add-to-context.gif" alt="code actions - add to context gif" width="80%" /%}
Example Chat Input:
Can you explain this function?
@myFile.js:15:25
(Where @myFile.js:15:25 represents the code added via "Add to Context")
Each of these actions can be performed "in a new task" or "in the current task."
There are three main ways to use Kilo Code's Code Actions:
Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS).Each code action gives you two options:
You can customize the prompts used for each Code Action by modifying the "Support Prompts" in the Prompts tab. This allows you to fine-tune the instructions given to the AI model and tailor the responses to your specific needs.
${filePath} and ${selectedText} to include information about the current file and selection.{% /tab %} {% /tabs %}
By using Kilo Code's Code Actions, you can quickly get AI-powered assistance directly within your coding workflow. This can save you time and help you write better code.