Features

Code actions

Access Bob's AI-powered code actions that provide quick fixes, refactorings, and code explanations directly in the Bob IDE through lightbulb icons and context menus.

Why use code actions?

  • Quick access to Bob: Add code to your conversation without copying and pasting
  • Contextual assistance: Get help with the exact code you are working on
  • Streamlined workflow: Access Bob's capabilities without leaving your editor
  • Automatic context: Bob receives file paths and line numbers automatically

How it works

Code actions appear when you:

  • Select a range of code
  • Place your cursor on a line with a diagnostic (error, warning, or hint)
  • Invoke them through a keyboard shortcut or command

A lightbulb icon () appears in the editor gutter (the area to the left of line numbers) when code actions are available. You can also access them through the right-click context menu or keyboard shortcut (Ctrl + . or Cmd + . on macOS).

Available code actions

Bob provides these code actions:

ActionDescription
Fix with BobAsks Bob to fix the diagnostics (errors or warnings) on the selected code. Shown instead of Explain and Improve when the selection has diagnostics.
Explain with BobAsks Bob to explain the selected code
Improve with BobAsks Bob to suggest improvements to the selected code
Add to Bob ContextAdds selected code to your Bob conversation with file path and line numbers

Add to Context

The Add to Context action is always available, as the last Bob action in the menu. When you use it, Bob includes the filename and line numbers with your code, helping Bob understand the exact location within your project.

Example of what Bob receives:

Can you explain this function?
@myFile.js:15:25

The @myFile.js:15:25 notation represents the code you added, including its location.

Keyboard shortcuts in the editor

These are editor commands, not lightbulb code actions:

  • Press Cmd + K (macOS) or Ctrl + K (Windows/Linux) in the editor to run IBM Bob: Inline edit, which opens an inline prompt to edit the code at the cursor or selection.
  • Press Cmd + L (macOS) or Ctrl + L (Windows/Linux) to run IBM Bob: Add to chat context, which adds the current selection to the Bob chat.

When you select code, a small tooltip with Edit and Chat buttons also appears.

Cmd/Ctrl + K works only while the editor has focus. Both shortcuts and the tooltip are unavailable in files excluded by .bobignore.

Using code actions

You can access Bob's code actions in three ways:

From the lightbulb icon

  1. Select the code you want to work with.
  2. Click the lightbulb icon () that appears in the gutter.
  3. Select the Bob action you want from the menu.
  4. Review Bob's response in the chat panel.

From the context menu

  1. Select the code you want to work with.
  2. Right-click the selected code.
  3. Select Bob from the context menu.
  4. Select the action you want from the submenu.
  5. Review Bob's response in the chat panel.

From the Command Palette

  1. Select the code you want to work with.
  2. Open the Command Palette with Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS).
  3. Type "Bob" to filter commands.
  4. Select the code action you want (for example, "Bob: Explain Code").
  5. Review Bob's response in the chat panel.

Bob's tip: The Command Palette applies actions to your current active chat task if one exists.

How is this topic?