Intellisense for available 'using/import's in C# with Visual Studio Code

11,196

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:

  1. Right click on C# extension
  2. "Extension settings"
  3. In opened "Settings" tab, add import in search area
  4. Enable Checkbox (Screenshot of this step)
  5. 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.

Share:
11,196

Related videos on Youtube

Fudge Fudge
Author by

Fudge Fudge

Competing for world record of most questions asked with no answer

Updated on October 26, 2022

Comments

  • Fudge Fudge
    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
    Gjaa almost 3 years
    Thanks! This is what I needed. I don't understand why this isn't enabled by default
  • Cloud
    Cloud about 2 years
    The setting ID is called omnisharp.enableImportCompletion