Automate code template creation for C & C++ development in Visual Studio Code with this handy tool. Say goodbye to manual setup and save time on repetitive tasks. Start your coding projects with consistency and efficiency, and focus on what matters most - writing great code.
This repository provides a solution to automate code template creation for C and C++ development in Visual Studio Code. It simplifies your development workflow by automatically including header files and establishing a fundamental code structure to enhance your productivity.
- Gets triggered as soon as a new .c or .cpp file is created.
- Automatically includes frequently used header files and initializes 'int main()' with 'return 0;'
- Ensures a consistent code structure for every project.
- Enhances productivity by eliminating manual setup distractions.
- Easy setup and integration into your Visual Studio Code workflow.
To use this automation tool, follow these steps:
-
Install Necessary Python Libraries: First, make sure you have the required Python library installed. You can install it using pip: pip install watchdog
-
Create Python Scripts:
- Create
detect.pyandautomate.pyin your working repository. You can copy the provided scripts or create your own.
- Configure Visual Studio Code:
- In your working repository, create a
.vscodefolder if it doesn't already exist. - Inside the
.vscodefolder, create atasks.jsonfile. You can copy the provided JSON configuration or customize it to your needs.
- Run the Task:
- In Visual Studio Code, press
Ctrl+Shift+Pto open the command palette. - Type and select "Run Task."
- Choose the "Detect new C and C++ Files" task you defined in the
tasks.jsonfile.
Now, every time a new .cpp file is created in the specified directory, your Python automation script (automate.py) will be executed, automating the desired task.
VSCode Tasks are a built-in feature of Visual Studio Code that allows you to automate various development-related tasks, such as building, testing, and running code. You can define and configure tasks to streamline your workflow and execute common actions with ease.
The Python Watchdog Library is a tool for monitoring file system events, such as file creation, modification, or deletion. It's used to detect and respond to changes in files and directories, making it valuable for automating actions based on real-time file system events, such as triggering scripts when a new file is created.
Let's simplify C & C++ development together! 🚀