Requires Visual Studio 2017 (community or higher)
- Select “Visual Studio extension development” within the Visual Studio installer
- Fork the CodeMaid source on GitHub
Check out GitHub issues labeled enhancement for ideas and to give others a heads up about what you might be thinking about doing.
Getting comfortable with the code
The code is broken up into three projects: CodeMaid (the core), IntegrationTests and UnitTests.
Within the core, CodeMaidPackage.cs is the start of it all and available in most code contexts. CodeMaid.vsct defines buttons, menu items, images and keyboard shortcuts.
- Helpers contains general utilities (e.g. the UndoTransactionHelper facilitates wrapping actions into an undo session).
- Integration handles wire-up to the IDE, and contains Commands (menu items) and Events (IDE event listeners).
- Logic contains the business logic rules and main functionality.
- Model contains representations of code objects (e.g. a method).
- UI contains all dialogs and tool windows.
If you have questions about where to find or insert something, please just contact me.
Testing/debugging your changes
Visual Studio provides an “Experimental Instance” of itself that is a sandbox environment for extensions. To test your changes, it is as simple as starting the project (F5) which will handle installing your changes into the experimental instance and launching it for debugging.
Running integration tests
Go to Test->Test Settings and make sure the “IntegrationTests.testsettings” file is displayed. If it isn’t, choose “Select Test Settings File” and select it from the file browser.
Integration tests vs. Unit tests
Integration tests launch inside Visual Studio and simulate user actions. Most of the tests provide before/after files to verify actions behave as expected. This is the vast majority of the existing tests and probably where you would want to add yours.
Unit tests are to verify stand alone code (e.g. helper classes) that do not need the IDE context.
There are a lot of tests in place, but adding more would always be welcome!