Code2Prompt is a JetBrains IntelliJ plugin that allows developers to copy the context of their projects including full file paths, contents, and error messages from IntelliJ-based IDEs to the clipboard in a format optimized for Large Language Models (LLMs).
- Open IntelliJ IDEA (or another JetBrains IDE).
- Go to File → Settings → Plugins.
- Search for Code2Prompt and install it.
- Restart your IDE.
- Download the latest Code2Prompt.jar from Releases.
- Open IntelliJ IDEA.
- Navigate to File → Settings → Plugins → Install Plugin from Disk.
- Select the downloaded
.jar
file. - Restart your IDE.
🔹 Seamless File & Content Copying: Copy full file paths and contents efficiently.
🔹 Error Message Extraction: Extract errors, including file paths and line numbers.
🔹 Right-Click Actions: Available in the Project View and Editor context menu.
🔹 Designed for LLMs: Optimized output format for AI-based workflows.
📂 Project View Actions:
- ✅ Right-click a file/folder → "Files to Prompt" to copy its contents.
- ✅ Right-click in the Project View → "Create .topromptignore" to exclude unwanted files.
📝 Editor Actions:
- ✅ Right-click code, underlined by code inspection, in the Editor View → "Error to Prompt".
- The error message, line number, file path and the complete file content will be copied.
- ✅ Right-click code, underlined by code inspection, in the Editor View → "Error to Prompt - No Code".
- The error message, line number and file path will be copied.
- Right-click any file or folder in the Project View.
- Select "Files to Prompt" from the context menu.
- The contents will be copied to the clipboard.
- Right-click on an error in the Editor View.
- Select "Copy Error to Prompt".
- The error message, file path, and line number will be copied.
- Right-click in the Project View.
- Select "Create .topromptignore".
- A
.topromptignore
file will be created in the project root (or next to.gitignore
if present). - By default, the content of the .gitignore will be copied and the extensions for binary and image files will be added.
- Modify
.topromptignore
to add the additional exclusions (e.g.,*.svg
,*.png
,*.class
).
This file works similarly to .gitignore
. Example:
# Ignore all images
*.jpg
*.png
*.svg
# Ignore build folders
build/
out/
# Ignore IntelliJ config files
.idea/
- 📌 JetBrains Plugin Marketplace: Marketplace Link
- 🛠 Source Code: GitHub Repository
- 🚀 Releases: Download Latest
- ❓ Report Issues: GitHub Issues
Inspired by: files-to-prompt 🔗
Supported by: SFEIR 🔗
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -m "Added a cool feature"
). - Push the branch (
git push origin feature-branch
). - Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
🚀 Happy coding with Code2Prompt! 🎯