Skip to content
| Marketplace
Sign in
Visual Studio Code>AI>Copy for PromptNew to Visual Studio Code? Get it now.
Copy for Prompt

Copy for Prompt

Antoine-lb

|
35 installs
| (0) | Free
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

🤖 Copy for Prompt

Copy for Prompt is a Visual Studio Code extension designed to streamline your workflow by allowing you to quickly copy files or folders in a format optimized for use with AI prompts, such as ChatGPT or other text-based tools.


Features

1. Copy Single File

Right-click any file in your project, and select "🤖 Copy for Prompt" to:

  • Copy the entire file content to your clipboard.
  • Prepend the file's name and relative path as a header for better context.

2. Copy Entire Folder

Right-click a folder in your project, and select "🤖 Copy for Prompt" to:

  • Copy all files in the folder recursively.
  • Include a directory structure tree for clarity.
  • Prepend each file's name and path as a header.
  • Append an end-of-folder marker for better readability.

Example Output

For a Single File:

================================================
File: src/lib/src/test/extension.test.ts
================================================
import * as assert from 'assert';

// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import * as vscode from 'vscode';
// import * as myExtension from '../../extension';

suite('Extension Test Suite', () => {
	vscode.window.showInformationMessage('Start all tests.');

	test('Sample test', () => {
		assert.strictEqual(-1, [1, 2, 3].indexOf(5));
		assert.strictEqual(-1, [1, 2, 3].indexOf(0));
	});
});


For a Folder:

================================================
Folder: src/lib/src
================================================
Directory structure:
├── extension.ts
└── test
    └── extension.test.ts

================================================
File: src/lib/src/extension.ts
================================================
import * as vscode from "vscode";
import * as fs from "fs";
import * as path from "path";

export function activate(context: vscode.ExtensionContext) {
  let disposable = vscode.commands.registerCommand(
    "extension.copyForPrompt",
    async (uri: vscode.Uri) => {
      try {
        const stat = await fs.promises.stat(uri.fsPath);

        if (stat.isDirectory()) {
          const folderContent = await processFolderWithTree(uri);
          await vscode.env.clipboard.writeText(folderContent);
          vscode.window.showInformationMessage(
            "Folder content copied to clipboard!"
          );
        } else if (stat.isFile()) {
          const fileContent = await processFile(uri);
          await vscode.env.clipboard.writeText(fileContent);
          vscode.window.showInformationMessage(
            "File content copied to clipboard!"
          );
        }
      } catch (error) {
        vscode.window.showErrorMessage("Failed to copy content: " + error);
      }
    }
  );

  context.subscriptions.push(disposable);
}
...


================================================
File: src/lib/src/test/extension.test.ts
================================================
import * as assert from 'assert';

// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import * as vscode from 'vscode';
// import * as myExtension from '../../extension';

suite('Extension Test Suite', () => {
	vscode.window.showInformationMessage('Start all tests.');

	test('Sample test', () => {
		assert.strictEqual(-1, [1, 2, 3].indexOf(5));
		assert.strictEqual(-1, [1, 2, 3].indexOf(0));
	});
});


================================================
End of Folder: src/lib/src
================================================


Installation

  1. Open Visual Studio Code.
  2. Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X on macOS).
  3. Search for "Copy for Prompt" and click Install.
  4. Once installed, right-click on any file or folder in your project to use the extension.

Usage

  1. Copy a File:

    • Right-click on a file in the Explorer.
    • Select "🤖 Copy for Prompt".
    • Paste the copied content into your favorite prompt-based tool or editor.
  2. Copy a Folder:

    • Right-click on a folder in the Explorer.
    • Select "🤖 Copy for Prompt".
    • Paste the copied content into your favorite prompt-based tool or editor.

Why Use This Plugin?

  • Optimized for AI Prompts: Includes file names, paths, and directory structures for better context when sharing or debugging code with AI tools.
  • Time-Saving: Instantly formats and copies content without manual adjustments.
  • Recursive Folder Support: Effortlessly copy entire folder contents with a single click.

Release Notes

1.0.0

  • Initial release of Copy for Prompt.
  • Support for copying single files and folders.
  • Recursive folder processing with directory tree generation.
  • Includes "end of folder" markers for improved structure.

Contribution

We welcome contributions! If you'd like to contribute to this project:

  1. Fork the repository.
  2. Submit a pull request with your changes.

Support

If you encounter any issues or have feature requests, please create an issue.


License

This extension is licensed under the MIT License.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft