> ## Documentation Index
> Fetch the complete documentation index at: https://docs.double.bot/llms.txt
> Use this file to discover all available pages before exploring further.

# CodeSnap

[CodeSnap](features/codesnap) lives inside of the [Chat](features/chat) sidebar, it appears whenever the AI generates a code snippet, either as a change to your existing code or entirely new code.

When you click the [CodeSnap](features/codesnap) bolt icon, it intelligently applies the edits into the current file and highlights the changes in diff style for you to approve.

### CodeSnap in action

<Steps>
  <Step title="Start with Chat">
    Start by asking the [Chat](features/chat) to make a change to an existing file, or to generate code from scratch.
  </Step>

  <Step title="Click the CodeSnap icon">
    <img className="block h-48 ml-0 dark:hidden max-w-full" height="140" src="https://mintcdn.com/double/-SaQhWM0WaCkpz-i/images/codesnap_light.png?fit=max&auto=format&n=-SaQhWM0WaCkpz-i&q=85&s=ab75206e45c0f17bc2aac6f4c8bef4bd" data-path="images/codesnap_light.png" />

    <img className="hidden h-48 ml-0 dark:block max-w-full" height="140" src="https://mintcdn.com/double/-SaQhWM0WaCkpz-i/images/codesnap_dark.png?fit=max&auto=format&n=-SaQhWM0WaCkpz-i&q=85&s=55fb7f25ea29b16bcce046dc144a8a1e" data-path="images/codesnap_dark.png" />

    When a code snippet is generated in [Chat](features/chat), you'll see the [CodeSnap](features/codesnap) icon appear on top of the code block.

    Immediately after clicking on the [CodeSnap](features/codesnap) icon, changes will be streamed into the current open file.
  </Step>

  <Step title="Review changes">
    <img className="block h-48 ml-0 dark:hidden max-w-full" height="140" src="https://mintcdn.com/double/dKjQdXGaKSgxICRk/images/review_light.png?fit=max&auto=format&n=dKjQdXGaKSgxICRk&q=85&s=cd2d4a5a332ccd9d417f50fa22101e4a" data-path="images/review_light.png" />

    <img className="hidden h-48 ml-0 dark:block max-w-full" height="140" src="https://mintcdn.com/double/dKjQdXGaKSgxICRk/images/review_dark.png?fit=max&auto=format&n=dKjQdXGaKSgxICRk&q=85&s=1653e557f2fc021bd16b47fcfb39ad1f" data-path="images/review_dark.png" />

    The changes made your code will be presented in diff style. Lines of code added will be highlighted in green, and lines of code removed will be highlighted in red.

    You can accept all or reject all of the changes by clicking on `Accept All` or `Reject All` buttons at the top of the editor, or with the `Cmd+Shift+Y` and `Cmd+Shift+N` keyboard shortcuts.

    Alternatively, you can accept or reject individual changes by clicking individually on the `Accept` or `Reject` buttons next to each change, or with the `Cmd+Y` and `Cmd+N` keyboard shortcut from top to bottom.
  </Step>
</Steps>

### FAQ

<AccordionGroup>
  <Accordion title="What context does CodeSnap have?">
    [CodeSnap](features/codesnap) is able to see the full contents of your current open file and the last 30k tokens from your [Chat](features/chat) conversation.
  </Accordion>

  <Accordion title="Can I use CodeSnap for multiple files at a time?">
    When you attach multiple files as context to a [Chat](features/chat) conversation, Double is able to see the files and file names, so it's able to suggest edits for multiple files by name.

    All you have to do is open each file individually and click on the [CodeSnap](features/codesnap) icon to apply the specific changes.
  </Accordion>
</AccordionGroup>
