Press a key and get an image of your code on your clipboard.
Credit
The idea for this extension belongs entirely to CodeSnap. If you want a full-featured, customizable code screenshot tool, use CodeSnap.
Codesnapper exists only to fix two problems I had with CodeSnap:
No keybind. CodeSnap opens a panel and waits for you to press its shutter button. Codesnapper captures straight from the keyboard.
Speed. CodeSnap has a noticeable delay between asking for a picture and getting it. Codesnapper renders without opening a webview, so the image is usually ready in 100–300 ms.
This extension is vibe coded. It was written by an AI (Claude), and I take no credit for its development.
Usage
Select some code and press Ctrl+Alt+C (Cmd+Alt+C on macOS). With nothing selected, the whole file is captured.
The image shows the code as it looks in your editor:
your color theme, font, font size and line height
bracket pair colors
real line numbers
a header with the file's icon from your icon theme and its file name
You can also run Codesnapper: Snap Code from the Command Palette or the editor's right-click menu. To change the key, search for codesnapper.snap in Keyboard Shortcuts.