Auto Import
is a Visual Studio extension that automates the process of importing classes and interfaces into your C# codebase. This can help streamline your development process by eliminating the need for manual importing of types, saving you time and reducing the chance of errors.
- Auto-detects the classes/interfaces used in your code and adds appropriate using statements.
- Refactors and renames identifiers, improving code readability and organization.
- Provides support for generic types.
- Allows integration into the constructor of a class.
This extension can be installed through the Visual Studio Marketplace. Click here to download and install.
Once the extension is installed, it will automatically run in the background. It analyzes your code as you type, detecting classes, interfaces, and binary expressions that require imports. If any are found, the extension will automatically generate the appropriate using
statements at the top of your code file.
The main functionality of the extension is defined in AutoImportCodeRefactoringProvider
. This class inherits from the CodeRefactoringProvider
class in the Microsoft.CodeAnalysis
namespace. The primary method, ComputeRefactoringsAsync
, performs the analysis and refactoring.
Additionally, the helper methods Refactor
, CreateDataModel
, and RenameGeneric
assist in handling specific aspects of the code refactoring process.
Contributions are always welcome. If you have any ideas for improvement, please feel free to fork the repository and create a pull request.
If you encounter any problems or have any questions, please open an issue on the GitHub repository.
This project is licensed under the MIT License.
Your feedback is important to make the project better. Feel free to contribute and help the developer community.