Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/leonkohli/snapsource

Code extension that allows you to easily copy file and folder contents along with the project tree structure to your clipboard
https://github.com/leonkohli/snapsource

ai chatgpt code extension vscode vscode-extension

Last synced: 15 days ago
JSON representation

Code extension that allows you to easily copy file and folder contents along with the project tree structure to your clipboard

Awesome Lists containing this project

README

        

# SnapSource

![SnapSource Logo](images/icon.png)

SnapSource is a powerful Visual Studio Code extension that allows you to easily copy file and folder contents along with the project tree structure to your clipboard. It automatically ignores dot files, respects .gitignore rules, and provides plaintext, markdown, and XML output formats. This tool is particularly useful when working with Large Language Models (LLMs) and you need to provide context about your project.

## ๐Ÿš€ Features

- ๐Ÿ“‹ Copy contents of files, folders, or multiple selections to your clipboard along with the project tree structure.
- ๐Ÿ”’ Automatically ignore dot files (like .env, .git) for security and cleanliness.
- ๐Ÿšซ Respect .gitignore rules and custom exclude patterns.
- ๐ŸŒณ Configurable project tree depth.
- ๐Ÿ“„ Three output formats: plaintext, markdown, and XML.
- โšก Asynchronous processing for improved performance with large directories.
- ๐Ÿ›ก๏ธ Robust error handling for various edge cases.
- ๐Ÿง  Smart binary file detection to exclude non-text content.
- ๐Ÿ“ Configurable file size limit to prevent oversized outputs.
- ๐Ÿ”ง Option to include or exclude project tree structure in the output.
- ๐Ÿ—œ๏ธ Simple code compression option for more compact output.
- ๐Ÿงน Option to remove comments from code.
- ๐Ÿ”ข Token counting and cost estimation for various LLM models.

## ๐Ÿ”ง How to Use

1. Select one or multiple files or folders in the VS Code Explorer.
2. Right-click and select "Copy to Clipboard (SnapSource)" from the context menu.
3. The file/folder content(s) and project tree (if enabled) will be copied to your clipboard, excluding dot files, binary files, and respecting ignore patterns and size limits.
4. Paste the content into your preferred LLM interface.

## โš™๏ธ Extension Settings

This extension contributes the following settings:

| Setting | Description | Default |
|---------|-------------|---------|
| `snapsource.ignoreGitIgnore` | Respect .gitignore rules when generating the project tree and copying files | `true` |
| `snapsource.maxDepth` | Maximum depth of the project tree | `5` |
| `snapsource.excludePatterns` | Additional patterns to exclude from the project tree and file copying | `["node_modules", "*.log"]` |
| `snapsource.outputFormat` | Output format for the copied content (options: "plaintext", "markdown", "xml") | `"plaintext"` |
| `snapsource.maxFileSize` | Maximum file size (in bytes) to include in the output | `1048576` (1MB) |
| `snapsource.includeProjectTree` | Include the project tree structure in the output | `true` |
| `snapsource.compressCode` | Remove extra whitespace and empty lines from code when copying | `false` |
| `snapsource.removeComments` | Remove comments from code when copying | `false` |
| `snapsource.llmModel` | LLM model to use for token count and cost estimation | `"gpt-4o"` |
| `snapsource.maxTokens` | Maximum number of tokens allowed before warning | `null` |
| `snapsource.enableTokenWarning` | Enable warning when token count exceeds the maximum | `true` |
| `snapsource.enableTokenCounting` | Enable token counting and cost estimation (requires network access) | `false` |

> **Note:** Dot files are always ignored, and binary files are automatically detected and excluded.

## ๐Ÿ“Š Output Formats

1. **Plaintext**: A simple text format with clear sections for project structure (if enabled) and file contents.
2. **Markdown**: A formatted markdown output with code blocks for project structure (if enabled) and file contents.
3. **XML**: A structured XML format with separate sections for project structure and file contents.

## ๐Ÿ“‹ Requirements

- Visual Studio Code version 1.89.0 or higher

## ๐Ÿ› Known Issues

None at this time.

## ๐Ÿ“ Release Notes

### 1.0.11

#### Fixed
- Resolved an issue where the `includeProjectTree` setting was not being respected.
- Fixed a linter error related to the `ignore` package usage.

#### Changed
- Removed unnecessary activation event from package.json.

For a full list of changes, please see the [CHANGELOG.md](CHANGELOG.md) file.

## ๐Ÿ’ฌ Feedback and Contributions

If you have any feedback or would like to contribute to the development of SnapSource, please visit our [GitHub repository](https://github.com/LeonKohli/snapsource).

---

**Enjoy using SnapSource!**

[![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/LeonKohli.snapsource.svg?style=for-the-badge&label=VS%20Code%20Marketplace&logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=LeonKohli.snapsource)
[![GitHub stars](https://img.shields.io/github/stars/LeonKohli/snapsource.svg?style=for-the-badge&logo=github)](https://github.com/yourusername/snapsource/stargazers)
[![License](https://img.shields.io/github/license/LeonKohli/snapsource.svg?style=for-the-badge)](https://github.com/yourusername/snapsource/blob/main/LICENSE)