Enable Auto File/Folder Creation in VS Code with
CodeGPT
1■■ Enable File Operations in CodeGPT
- Open VS Code → Settings → Extensions → CodeGPT. - Turn on “Allow File Operations” (if
available). - This lets AI suggest create, edit, or delete files automatically.
2■■ Add VS Code Tasks for File Creation
Create a `.vscode/[Link]` file with the following config:
{
"version": "2.0.0",
"tasks": [
{
"label": "Create File",
"type": "shell",
"command": "echo '${input:content}' > ${input:filename}"
},
{
"label": "Create Folder",
"type": "shell",
"command": "mkdir -p ${input:foldername}"
}
],
"inputs": [
{ "id": "filename", "type": "promptString", "description": "Enter file path" },
{ "id": "content", "type": "promptString", "description": "Enter file content" },
{ "id": "foldername", "type": "promptString", "description": "Enter folder name" }
]
}
3■■ How It Works
• Ask AI: 'Make [Link] with Scaffold and AppBar in lib/screens/'.
• AI generates the code.
• AI suggests: Run task → Create File.
• You confirm → File + code appear automatically.
4■■ Optional Boost
- Install 'File Templates' extension from VS Code Marketplace. - Lets AI use pre-defined templates
for Flutter screens, [Link] routes, etc. - Example: “Use File Template → Flutter Screen” →
auto-generates the file.
■ Result: Your VS Code + CodeGPT + Ollama setup can now: - Create files & folders automatically
- Write AI-generated code inside them - Build project structure seamlessly This makes VS Code
behave much closer to Cursor (with one confirmation step for safety).