Sync Block Edit Simplifies Code Editing
Sync Block Edit is a Visual Studio extension which automatically updates duplicate blocks of text in multiple files. It will be useful for updating the content in copyright files inside the source code in large applications or for updating large chunks of content such as comments. The extension can be accessed from the Visual Studio 2012 toolbar after the installation of VSIX file.
In order to work with Sync Block Edit extension you have to follow the steps:
- Enclose the content inside one of the source file with a distinct begin and end signature lines
// BEGIN copyright starts
// Your content here
// END copyright ends
- Select the block and click the Sync Update Block button from the Sync Block Edit toolbar
For example, if you have two forms (Form1 and Form2) in your Windows application, you only need to make the required change in Form1. The required changes will be automatically reflected in Form2.
Let us visually examine the usage of Sync Block Edit extension
Form1 with original content
Form2 with original content
Form1 with changes - Sync Update Block in Action
Update Text Dialog
You can select a required choice from the Target drop down. By default, the begin and end lines are populated with the required text from the source file.
Form2 with changes
As you can observe from the above screenshots, I have only updated the content in Form1.
If you have not added the distinct begin and end blocks then you can create it using Sync Create Block button from the Sync Block Edit toolbar.
- Select the content for which you want to add begin and end blocks
- Provide the content for the begin and end blocks
- Select the target
- Click the Create button
The extension automatically adds the required begin and end lines depending upon the target you selected. If you select Entire Solution as target the block will be placed on all the files of the project.