Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>GPT CodeSlicerNew to Visual Studio Code? Get it now.
GPT CodeSlicer

GPT CodeSlicer

RuslanSay

|
51 installs
| (0) | Free
A VS Code extension for splitting ChatGPT-generated multi-file outputs into organized files and folders.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

GPT CodeSlicer

GPT CodeSlicer is a Visual Studio Code extension that simplifies organizing multi-file code outputs generated by ChatGPT or similar tools. It uses delimiter comments (e.g., // path/to/file.ext) to identify file boundaries and automatically splits the content into properly structured files and folders.

Features

  • Multi-file Splitting: Easily split concatenated multi-file code snippets based on delimiter comments.
  • Flexible Input Sources:
    • Split code from the currently active file in the editor.
    • Split code directly from the system clipboard.
  • Dynamic Output Directories:
    • Choose a custom folder.
    • Use the same directory as the source file.
    • Select a folder or file in the Explorer and split directly into that location.
  • Optional Formatting: If enabled via gptCodeSlicer.runFormatterOnSave, the extension will run the VS Code formatter on each created file after splitting, respecting the user's editor settings for indentation.
  • Optional Context Menu Entry: Control whether the clipboard splitting command appears in the Explorer context menu by toggling gptCodeSlicer.showInContextMenu.
  • Automatic Folder Creation: Automatically creates directories as specified in the file paths.
  • File Overwrite Prompt: If a file already exists, you are asked whether to overwrite or skip it.

Commands

  1. GPT CodeSlicer: Split Files to Folder (splitter.splitFileToFolder)
    Prompts for a target directory and splits the currently open file into separate files.

  2. GPT CodeSlicer: Split Files Here (splitter.splitFileToSameFolder)
    Splits the currently open file and saves the resulting files into the same directory as the source file.

  3. GPT CodeSlicer: Split Clipboard to Folder (splitter.splitClipboardToFolder)
    Splits the system clipboard content into files, prompting for a target directory.

  4. GPT CodeSlicer: Split Clipboard to Selected Folder (splitter.splitClipboardToSelectedFolder)
    Splits the clipboard content directly into the folder (or the folder of a selected file) chosen in the Explorer panel.
    Controlled by the gptCodeSlicer.showInContextMenu setting.

Configuration

Extension Settings:

  • gptCodeSlicer.showInContextMenu (boolean)
    Default: true
    When true, displays the "Split Clipboard to Selected Folder" command in the Explorer context menu. Set it to false to reduce clutter if desired.

  • gptCodeSlicer.runFormatterOnSave (boolean)
    Default: false
    When true, the extension runs the VS Code formatter on each created file after splitting. It uses the user's editor.tabSize and editor.insertSpaces settings to determine formatting style.

Example (settings.json):

{
  "gptCodeSlicer.showInContextMenu": false,
  "gptCodeSlicer.runFormatterOnSave": true
}

Example

Splitting from Clipboard to a Selected Folder with Formatting

Setup:

  • Copy text containing delimiters into your clipboard, for example:

    // pages/Home.js
    export default function Home() {
      return <h1>Home Page</h1>;
    }
    
    // pages/About.js
    export default function About() {
      return <h1>About Page</h1>;
    }
    
  • Enable formatting in your settings.json:

    "gptCodeSlicer.runFormatterOnSave": true
    

Action:

  • In VS Code’s Explorer, right-click on a folder named website.
  • If gptCodeSlicer.showInContextMenu is true, select GPT CodeSlicer: Split Clipboard to Selected Folder.
  • The files are created and then formatted automatically based on your editor settings (editor.tabSize, editor.insertSpaces).

Result:

website/
└── pages/
    ├── Home.js   (formatted)
    └── About.js  (formatted)

Installation

You can install this extension directly from the VS Code Marketplace by searching for "GPT CodeSlicer."

Build and Install Locally

  1. Clone the repository:

    git clone https://github.com/RuslanSay/gpt-codeslicer.git
    cd gpt-codeslicer
    
  2. Install dependencies and compile:

    npm install
    npm run compile
    
  3. Install the extension in VS Code:

    code --install-extension gpt-codeslicer-1.1.8.vsix
    

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

License

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

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