Docs / Desktop Workspace / Code Editor & Highlight-to-Ask AI

Code Editor & Highlight-to-Ask AI

Code editing, syntax highlighting, and inline code selection actions in BhaiCode Desktop.

BhaiCode Desktop includes a responsive code editor powered by CodeMirror 6, paired with inline code selection actions.


"Ask AI on Selection"

Highlight any lines of code in the editor to trigger the contextual action bar:

TEXT
┌─────────────────────────────────────────────────────────────┐
│ 42  export async function processPayment(orderId: string) { │
│ 43    const order = await db.order.findUnique({ ... });     │
│ 44    if (!order) throw new Error("Order not found");       │
│ 45 ┌──────────────────────────────────────────────────────┐ │
│ 46 │  const res = await dodoPayments.charges.create({     │ │
│ 47 │    amount: order.totalAmount, currency: "INR"        │ │
│ 48 │  });                                                 │ │
│    └──────────────────────────────────────────────────────┘ │
│       [ Ask AI ]  [ Explain ]  [ Refactor ]  [ Add Tests ]   │
└─────────────────────────────────────────────────────────────┘

Available Actions

  1. Ask AI (Cmd + K / Ctrl + K): Opens a contextual prompt attached directly to the highlighted code.
  2. Explain: Explains the logic, time complexity, and edge cases of the selection in your preferred language (English, Hindi, etc.).
  3. Refactor: Rewrites the snippet for readability, modern framework patterns, or performance.
  4. Add Unit Tests: Generates unit tests matching your project's testing framework (Vitest, Jest, PyTest, Go test).
  5. Fix: If a linter warning or compiler diagnostic is attached to the line, clicking Fix resolves it automatically.

Editor Features

  • Language Support: Syntax highlighting, bracket matching, and indentation for 100+ languages (TypeScript, JavaScript, Python, Rust, Go, SQL, HTML, CSS, JSON, YAML, Markdown).
  • Split Panes & Multi-Tab: Open multiple files side-by-side to cross-reference implementations and tests.
  • Minimap & Breadcrumbs: Navigate large files with a visual minimap and symbol breadcrumbs.
  • Find & Replace: Regex-enabled project-wide search with case sensitivity toggles.

Ready to build with AI?

Start building for free with your own keys, or unlock managed compute in seconds