In Eclipse, autocomplete works even for unused packages or namespaces. That means that if I have a class named DuckWrapper in a package, and in a class that didn't import the package DuckWrapper I press ctrl+space, it will display DuckWrapper and automatically import its package if necessary.
Visual Studio however, doesn't show it in its autocompletion unless I added it first to the using list.
Can that be changed?
To do it, you may either manually type the Using Namespace or you just right click on the class name and select Resolve > Namespace. But using “Ctrl+.” you can automatically add the namespace in your code.
This kind of feature exists in current version of Visual Studio 2019 but it is still experimental.
As you can see in the image above, you can't see the entity Student
from the namespace Test2 that's in another project but if you click button in the bottom left corner of IntelliSense window, you will see this.
Upon accepting Student option that IntelliSense gives, all needed namespaces will automatically be added at the top of your file (or bellow all the existing using statements above the namespace name).
You can turn this option on/off in:
EDIT: I embedded the images instead of just hyperlinking them.
You may use the IntelliSense Extender Plugin. For Visual Studio 2017:
https://marketplace.visualstudio.com/items?itemName=Dreamescaper.IntelliSenseExtender
And for VS 2019:
https://marketplace.visualstudio.com/items?itemName=Dreamescaper.IntellisenseExtender2019
It includes the types of all projects in the solution and of all referenced packages. Selecting an not imported type from IntelliSense will then auto import that type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With