Intellisense for available 'using/import's in C# with Visual Studio Code
Solution 1
If you use "C# extension" for VSCode (this https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp)
you can try follow next steps:
- Right click on C# extension
- "Extension settings"
- In opened "Settings" tab, add
import
in search area - Enable Checkbox (Screenshot of this step)
- Enjoy autoimport without "special" extension (Screenshot)
Solution 2
I just went ahead and made the extension:
https://marketplace.visualstudio.com/items?itemName=Fudge.auto-using#overview
Currently it supports only the base C# libraries but I can make it use additional nugget libraries as well if there is demand for that.
As of 24/11/2020 the official C# extension supports this feature, see other answer.
Related videos on Youtube
Fudge Fudge
Competing for world record of most questions asked with no answer
Updated on October 26, 2022Comments
-
Fudge Fudge over 1 year
Edit: Vidual Studio Code and Visual Studio are 2 different things. Yes it's confusing but I know that VS has this feature, I'm asking about VS code.
Is there some extension/setting that makes Visual Studio Code's c# have Intellisense for all available namespaces, including those that were not yet imported, and then imports them when selected?
Example: Collections are not yet imported and I want to type IEnumerable and import it. Being the average programmer this is quite tedious and I might screw up the spelling or capitalization, and then have to press ctrl+.. I would like to just be able to type "ienu" and then IEnumerable would pop up and would be autocompleted and auto imported.
This feature exists for Typescript in VScode (thanks to an extension), and even for C# but in Visual Studio with the Resharper extension.
I have searched everywhere for this feature but it seems to me like it doesn't exist. It honestly feels insane to code without this.
-
Gjaa almost 3 yearsThanks! This is what I needed. I don't understand why this isn't enabled by default
-
Cloud about 2 yearsThe setting ID is called
omnisharp.enableImportCompletion