Todo Prompt
A VS Code extension that makes it easy to send TODO comments to AI chatbots for assistance. With a single click, generate an LLM-optimized prompt containing your code context and copy it to your clipboard.
Features
- CodeLens Buttons Above TODOs: Displays a clickable "✓ Copy prompt" button above every TODO comment in your code
- Comment-Style TODO Detection: Matches TODOs in
// line comments, /* */ block comments (including leading *), and HTML <!-- --> comments
- One-Click Prompt Generation: Click the button to generate a structured prompt with:
- File path and name metadata
- Line number of the TODO
- Full source code content
- Clear instructions for AI models
- Copy Whole File for Prompt: Right-click an editor tab and choose "Copy file prompt" to copy that file wrapped in
<file name=""> XML tags (leading/trailing whitespace trimmed)
- Copy Selection for Prompt: Select code, right-click, and choose "Copy selection prompt" to copy just the selected text wrapped in
<code> XML tags (leading/trailing whitespace trimmed)
- Clipboard Ready: Automatically copies the formatted prompt to your clipboard
- LLM-Optimized Format: Uses structured tags designed for AI chatbots like ChatGPT
- Works with Multiple Languages: Supports TypeScript/TSX, JavaScript/JSX, Python, Java, C#, C++, C, Go, Rust, Ruby, PHP, and more
How to Use
- Open any source file with TODO comments
- Look for the "✓ Copy prompt" button that appears above each TODO comment (via CodeLens)
- Click the button
- A notification confirms the prompt has been copied to your clipboard
- Paste the prompt into your favorite AI chatbot (ChatGPT, Claude, etc.)
- The AI will have full context including the code, file info, and line number
To copy an entire file for a prompt:
- Right-click the file's editor tab and select "Copy file prompt", or run "Todo Prompt: Copy file prompt" from the Command Palette (Ctrl+Shift+P)
- Paste the XML-wrapped file into your chatbot (content is trimmed to remove leading/trailing whitespace)
To copy a selection for a prompt:
- Select the code you want, right-click the selection, and choose "Copy selection prompt", or run "Todo Prompt: Copy selection prompt" from the Command Palette (Ctrl+Shift+P)
- Paste the XML-wrapped selection into your chatbot (content is trimmed to remove leading/trailing whitespace)
Prompt Template
The generated prompt includes:
- File metadata: Path, name, and line number of the TODO
- Source code: The full file content wrapped in XML tags for clarity
- Clear instructions: A direct request to implement the TODO comment
Example format (from prompt-template.txt):
### Task:
You are to implement the `TODO` comment in the file.
<todo_instruction>
[TODO comment text]
</todo_instruction>
<metadata>
<file_path>src/components/button.ts</file_path>
<file_name>button.ts</file_name>
<line_number>42</line_number>
</metadata>
<source_code>
[full file content]
</source_code>
### Instructions:
Please review the TODO comment on line 42 in the code above and implement a solution.
Requirements
Dev Locally
Run:
npm install
Then F5 in Visual Studio Code to open the Extension Development Host for debugging.
Dev Container Setup
If you develop inside a GitHub Codespace or VS Code dev container, the repository includes a .devcontainer/devcontainer.json that installs the system libraries needed to run npm run test (VS Code's Electron-based test runner). Rebuild the container after pulling the latest changes to ensure the dependencies are installed.
Deployments
Pushing to the main branch triggers a release build and publishes to the Visual Studio Code Extension Marketplace. After pushing to this branch confirm the release by visiting https://marketplace.visualstudio.com/manage/publishers/neworange-simon and checking the version number of the extension.
Note you must first increment the version number in package.json or the publish will be rejected.
Extension Settings
This extension doesn't require any configuration. It works automatically on any file with TODO comments.
Known Issues
None at this time.
Release Notes
0.0.1
Initial release of Todo Prompt extension with:
- CodeLens integration for TODO detection
- One-click prompt generation
- Clipboard integration
- LLM-optimized formatting
Enjoy! Happy coding with AI assistance!