Virtual Developer Workshop: Containerized Development with Docker
Environment: Visual Studio
The simple VBScript macro below provides this feature that lacks native support within Visual Studio. I won't argue that this is an ideal implementation but it ought to work in general. To implement it, unzip exclude.dsm from the attached zip file to some place on your computer. Next, do the following:
- Unzip exclude.dsm from the zip file below
- Within Visual Studio click on Tools/Customize.../Add-ins and Macro Files
- Browse and select the exclude.dsm file
- Check the box to the left of exclude.dsm in order to enable it
If you'd like to assign keys to these functions:
- Click on Tools/Customize.../Keyboard/Category/Macros
- Select exclude then assign something to it such as Alt+X
- Select unexclude then assign something to it such as Alt+U
How it works:
When you select some lines then perform an exclude it cuts those lines and pastes them into a file named excludes.txt that is placed next to msdev.exe (if you don't like this location then simply modify the GetExcludeFileName function so that it instead returns where that file ought to be located). Unexclude works in reverse. When you perform an exclude it creates a special line that it puts in place of the removed lines that looks like this:
<===== Excluded Lines=5 Date=9/6/01 Time=1:31:51 PM =====>
This signature is used during an unexclude operation. You must place the cursor on that line when you want to perform an unexclude to bring the lines back.
Limitations and improvements:
You mustn't exclude two groups of lines within the same second, not that I believe that is possible.
If you have an improvement please let me know!