10

This question comes up a lot, is there any way to get Microsoft's attention and convince them to stop inserting this extremely annoying feature?

If I have a C# file that doesn't currently use System.Collections.Generic, and I type a line like this:

List<string> moose = new();

VS then happily inserts

using iTextSharp.text;

which is of course completely wrong.

I swear it's like Clippy all over again but without checking before making any changes.

There is an option in the Tools menu that other questions say should control this feature, but apparently Microsoft left the option in but ignores the value (although to be fair I'm not pasting anything):

enter image description here

There is another question that does say "tab completion will still auto-add missing using directives" but in my case I'm not tab-completing. I'm just typing in the line of code.

Has anyone found a way to disable this "feature"?

7
  • 1
    Yeah it's been annoyingly off for a couple of months already. For me it's been auto-importing DocumentFormat.OpenXml.Office2019.Drawing namespace every time I type something like Model (Model3D lives in that namespace). Commented Mar 10, 2023 at 15:56
  • 5
    is there any way to get Microsoft's attention: Report a problem with the Visual Studio product or installer, Developer Community guidelines, and Developer Community Commented Mar 10, 2023 at 15:59
  • The following may (or may not) be helpful: stackoverflow.com/a/70097398/10024425 Commented Mar 10, 2023 at 16:01
  • 2
    @user09938 a yes the developer community, where 250 questions a day get posted and zero answered. Welcome to customer support in 2015+. Commented Mar 10, 2023 at 16:55
  • 1
    @CodeCaster: What exactly do you mean by answered? I received a response to both of my questions: Needs more information and/or the issue is not reproducible and will be closed within 14 days -- even though I included the steps necessary to reproduce the issue, Obviously not a solution, but some may consider a response to be an answer. Additionally, some may consider a lack of response an answer as well. I imagine that occassionally they select a question to try to find a solution to. Who knows, maybe one will win the question lottery and someone will offer a solution. Commented Mar 11, 2023 at 20:15

1 Answer 1

11

I followed the "report a problem with VS" link and got a response within about a day! Their initial answer was that the "Show items from unimported namespaces" option does what I want. Unchecking that did indeed disable the insertion of the 'using' statement.

I did submit a follow-up bug asking that they fix the text of the option, as "show items from unimported namespaces" does not at all indicate "and add using statements".

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

You can see the entire bug report, and their fix that actually worked, here: github.com/dotnet/roslyn/issues/67372
"Show items from unimported namespaces" is actually useful. The problem is "Default IntelliSense completion mode: Automatic" and should be changed to "Tab-only"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.