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
GPT CodeSlicer: Split Files to Folder (splitter.splitFileToFolder)
Prompts for a target directory and splits the currently open file into separate files.
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.
GPT CodeSlicer: Split Clipboard to Folder (splitter.splitClipboardToFolder)
Splits the system clipboard content into files, prompting for a target directory.
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.