Feature Request: Dedicated "Explain Code" Command

Feature request for product/service

Cursor IDE

Describe the request

Feature Request: Dedicated “Explain Code” Command

Summary

Please add a dedicated cursorai.action.explainCode command that can be bound to a custom keyboard shortcut, similar to how JetBrains AI Assistant and GitHub Copilot implement this feature.

Current Situation

Currently, to explain selected code in Cursor, users must:

  1. Select code
  2. Press Cmd+L to open AI Chat
  3. Manually type “Explain this code”
  4. Press Enter

This is a 4-step process for one of the most common AI-assisted coding tasks.

How Competitors Handle This

JetBrains AI Assistant

  • Right-click → “Explain with AI” (context menu)
  • Dedicated action: Available in Find Action (Cmd+Shift+A)
  • One-click solution

GitHub Copilot (VSCode)

  • Right-click → “Copilot” → “Explain This” (context menu)
  • Command ID: github.copilot.interactiveEditor.explain
  • Can be bound to any keyboard shortcut

VSCode Built-in (with Copilot Chat)

  • Select code → /explain command in chat
  • Slash commands provide quick access

Proposed Solution

Add a dedicated command:

{
  "command": "cursorai.action.explainCode",
  "title": "Cursor: Explain Selected Code"
}

Expected Behavior

  1. User selects code
  2. User triggers command (via shortcut or context menu)
  3. AI Chat opens automatically with “Explain this code” pre-filled
  4. Explanation begins immediately

Bonus: Context Menu Integration

Add “Explain with AI” to the editor context menu (right-click):

─────────────────────────
  Edit with AI (Cmd+K)
  Explain with AI        ← NEW
  Chat about Code (Cmd+L)
─────────────────────────

Why This Matters

Current Workflow Proposed Workflow
Select → Cmd+L → Type “explain” → Enter Select → Cmd+Shift+E
4 steps, ~5 seconds 1 step, instant
Requires typing No typing needed
Can’t customize shortcut Fully customizable

Use Cases

  • Code review: Quickly understand unfamiliar code
  • Learning: New developers exploring a codebase
  • Debugging: Understanding complex logic before fixing
  • Onboarding: Getting up to speed on legacy code

Additional Context

I’ve looked through keybindings.json and the command palette, but couldn’t find any existing command for this. The closest commands are:

  • aichat.newchataction - Opens chat (but doesn’t pre-fill prompt)
  • aipopup.action.modal.generate - Opens inline edit (not for explanations)

Currently, I’m using a Keyboard Maestro macro as a workaround, but this:

  • Only works on macOS
  • Requires external software
  • Feels like a hack for basic functionality

Summary

Cursor is marketed as an “AI-first code editor,” yet it lacks a one-click “Explain Code” command that both JetBrains and GitHub Copilot have had for years. This seems like low-hanging fruit that would significantly improve the user experience.

Requested commands:

  • cursorai.action.explainCode - Explain selected code
  • cursorai.action.documentCode - Generate documentation (bonus)
  • cursorai.action.refactorCode - Suggest refactoring (bonus)

Thank you for considering this feature! :folded_hands:


Environment:

  • Cursor Version: Latest
  • OS: macOS
  • Related: Keyboard shortcuts, AI Chat, Context menu

Screenshot / Screen Recording

Operating System (if it applies)

Windows 10/11
MacOS
Linux

1 Like

Hey, thanks for the detailed feature request!

I see the JetBrains screenshot, so it’s clear what kind of UX you mean. A similar request was already posted on the forum here: Creating a keyboard shortcut to explain the text selection? ( and/or any other prompts ).

Right now there’s no native cursorai.action.explainCode command, but there’s a workaround using custom commands: Commands | Cursor Docs.

How to set it up:

  1. Create a file .cursor/commands/explain.md in your project, or ~/.cursor/commands/explain.md for global access:
# Explain Code

Explain the selected code in detail:
-  What it does
-  How it works step by step
-  Important patterns and techniques used
  1. Then the workflow is: select code, Cmd+L, type /explain, press Enter.

It’s not quite one click like in JetBrains, but you don’t have to type “explain this” every time anymore. You can also create /document, /refactor, and other commands the same way.

I’ll pass the request for a proper command with shortcut support to the team.

2 Likes

@deanrie Thanks for super fast response!
I’ll create explain command as a workaround.

I’m sorry for posting a duplicate feature request, but I honestly think that just shows how it’s one of the most fundamental use cases for AI and that there’s a lot of potential demand. I’d really appreciate it if you could consider it :man_bowing:t3:

1 Like