Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Copy Opened Files For AI/LLMNew to Visual Studio Code? Get it now.
Copy Opened Files For AI/LLM

Copy Opened Files For AI/LLM

Louis Lacoste

|
462 installs
| (1) | Free
Easily copy all opened files to give to your favorite LLM
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

LLM Copy Files

Overview

The "LLM Copy Files" extension for Visual Studio Code provides convenient ways to consolidate the contents of all currently open files or files within selected folders. You can either combine the contents into a single new file or copy them directly to the clipboard. This is particularly useful for quickly compiling code snippets, creating backups, or preparing code for sharing with others or large language models (LLMs).

Features

  • Copy Opened Files: Copies the content of all open files in the editor and combines them into a single new file.
  • Copy Opened Files to Clipboard: Copies the content of all open files directly to the clipboard.
  • Get Files in Folder: Recursively retrieves and combines the content of all files within selected folders into a single new file.
  • File Titles Included: Each file's content is preceded by its file name for easy identification.
  • Language Syntax Highlighting: The language of each file is preserved in the copied content for proper syntax highlighting.
  • Excludes Empty Files: Files with empty content are automatically excluded.
  • Excludes Duplicate Files: Ensures each file is only copied once, even if opened multiple times.
  • Relative File Paths: File paths are displayed relative to the workspace root for better readability.
  • Multiple Folder Selection: Supports processing multiple folders.
  • Progress Notification: Displays a notification during the processing of files.

Installation

  1. From the Marketplace:

    • Visit the Visual Studio Code Marketplace and search for "LLM Copy Files."
    • Click "Install" to add the extension to your VS Code.
  2. Manual Installation:

    • Download the latest .vsix file from the releases page.
    • Open VS Code, go to the Extensions view by clicking the Extensions icon in the Activity Bar.
    • Click the ... at the top-right corner of the Extensions view, select Install from VSIX..., and choose the downloaded .vsix file.

Usage

  1. Open all the files you want to copy in VS Code or select the desired folders in the Explorer view.
  2. Press Ctrl+Shift+P (or Cmd+Shift+P on macOS) to open the Command Palette.
  3. Type LLM Copy Files and select one of the available commands:
    • Copy Opened Files: Creates a new file containing the content of all open files, each prefixed with its respective file name and properly syntax highlighted.
    • Copy Opened Files to Clipboard: Copies the content of all open files directly to the clipboard, formatted similarly to the "Copy Opened Files" command.
    • Get Files in Folder: Right-click on one or more folders in the Explorer view and select "Get Files in Folder" to collect and combine the content of all files within the selected folders into a single new file.

Example

If you have the following files open in VS Code:

  • file1.js:

    console.log("This is file 1");
    
  • file2.js:

    console.log("This is file 2");
    

Running the "Copy Opened Files" command will create a new file with the following content:

# file1.js

\`\`\`javascript
console.log("This is file 1");
\`\`\`

# file2.js

\`\`\`javascript
console.log("This is file 2");
\`\`\`

Development

Prerequisites

  • Node.js
  • VS Code
  • TypeScript

Building the Extension

  1. Clone the repository:
    git clone https://github.com/yourusername/llm-copy-files.git
    cd llm-copy-files
    
  2. Install dependencies:
    npm install
    
  3. Compile the TypeScript code:
    npm run compile
    
  4. Launch the extension in VS Code:
    • Open the project in VS Code.
    • Press F5 to open a new VS Code window with the extension loaded.

Publishing

  1. Ensure you have the vsce tool installed:
    npm install -g vsce
    
  2. Package the extension:
    vsce package
    
  3. Publish the extension:
    vsce publish
    

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any bugs, feature requests, or improvements.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

This extension was inspired by the need to quickly share code snippets with AI language models like ChatGPT. Special thanks to the developers of Visual Studio Code and the VS Code Extension API for making this possible.

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