73

NOTE The keyword here is "default". I know I can hit escape and the default behavior gets aborted. I don't want to hit the escape key every time the IDE thinks it knows what I want. I didn't have to do this in 2013.

ADDENDUM 2 It seems I'm still having difficulty communicating what I'm after here. What I want to happen is nothing when I press the space bar... I just want a space character to show up on my screen. The only time I want the IDE to actually insert a suggestion is when I hit the tab bar. I hope that's clearer?

This is driving me nuts. 2013 and before allowed you to set completion characters (maybe that was resharper?) But in 2015 I see no way to stop the default behavior of autocomplete.

For example, say I have a class Foo, but I don't have the namespace specified already, yet I have a class FooBar in one of the specified namespaces, if I type:

public void DoSomething(Foo// <-- then a space)

...it automatically puts FooBar. How the heck do I turn off this behavior?

I should mention that I still want Autocomplete, just on tab though.

Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63
Jeremy Holovacs
  • 22,480
  • 33
  • 117
  • 254

12 Answers12

71

Edit -> Intellisense -> Toggle Completion Mode

From : https://msdn.microsoft.com/en-us/library/hcw1s69b.aspx

"You can also change to suggestion mode, in which only the text you type is inserted into the code. For example, if you enter an identifier that is not in the list and press TAB, in completion mode the entry would replace the typed identifier. To toggle between completion mode and suggestion mode, press CTRL+ALT+SPACEBAR or click Edit/IntelliSense/Toggle Completion Mode."

Robbie
  • 1,291
  • 12
  • 10
  • 23
    Thanks so much, this is the most annoying default behaviour I've encountered in ages. – a2800276 Sep 05 '16 at 10:50
  • 17
    I can't upvote this enough. I literally searched for hours in the options and on the web, for this exact setting that is just not where I was looking. – youen Jul 26 '17 at 08:20
  • 3
    Unfortunately, "Toggle Completion Mode" is greyed out for me. – Jesbus Apr 03 '19 at 21:10
  • 2
    I am with @youen with wanting to upvote this many many more times! – Ari Black Apr 14 '20 at 09:33
  • 2
    I made an account just to upvote this comment. Microsoft, this is the worst default behavior I've ever encountered in professional software. Fix this. – kiaran_ritchie Oct 25 '20 at 23:45
  • Too bad this doesn't work on the .aspx side... My CSS constantly thinks I want col-lg-1 when I just want col... Going to kill myself. – Taylor Brown Aug 06 '21 at 18:53
  • I am blown away how this objectively terrible deafult setting keeps making it's way back in to releases. I must have fixed this three times in the last 5 years, i mean how could you DEFER to the suggestion on the commit keystroke? Like. WHAT? – GeneralZod Dec 03 '22 at 15:22
30

For all who have the same problem in Visual Studio Code, add this line to the User Settings:

"editor.acceptSuggestionOnCommitCharacter": false
Dionysos
  • 301
  • 3
  • 3
  • 2
    OMG FINALLY. Thank you. It just kept completing to the wrong thing if i typed something followed by space too quickly. – Levi Aug 30 '20 at 01:31
  • The setting is also accessible in the UI, at least as of August 2021. – hmijail Aug 16 '21 at 01:58
  • 3
    Thank you so much for this. It is absolutely maddening when you try to type e.g. `int i` but accidentally press space after `in` and VSCode auto-fills some absurdly verbose class name from a random package and you end up with `InvalidAsyncThreadPoolExecutionContextWithoutCancellationTokenForAbsurdStackOverflowExample i`. – Thomas Dec 19 '22 at 22:03
5

If you're using Resharper and Visual studio 2017, you may need to use a combination of the existing answers to stop getting the autocomplete behaviour when pressing space. This is too long for a comment so added an answer.

  1. Make sure in Visual studio that intellisense Toggle Complete Mode is off/unselected (as noted in other answers). Note: If you turn on the "Text editor" icons in the VS toolbar at the top, you'll see an extra icon that gets highlighted on and off showing you whether intellisense is toggled on or off. AND

  2. In the resharper dropdown on the toolbar (Resharper > Options...), Go to IntelliSense > Completing Charactes > and then uncheck the "Complete on space" box for C#.

Now autocomplete doesn't occur when pressing space (can still use tab, etc to autocomplete).

(Related aside: This autocomplete on space is really bad if you use VSVim, because you can't by default use the typically vim ESC key to 'get out' of the autocomplete mode. e.g. it's very difficult to even type in the static modifier for a variable/function without it changing to some other autocomplete choice.)

FXQuantTrader
  • 6,821
  • 3
  • 36
  • 67
5

For those looking for the same thing in VSCode (2022)

File -> Preferences -> Settings and search for Accept Suggestion On Commit Character.

Make sure this setting is unchecked: Accept Suggestion On Commit Character

Snailedlt
  • 460
  • 6
  • 14
3

change the setting for Editor: Accept Suggestion On Enter to off

Chris Concannon
  • 383
  • 4
  • 9
2

If you use Vs2017 and the setting resets everytime you launch Vs, i created a small script that automatically disables space completion at launch using Visual Commander Extension:

enter link description here

EncoderX
  • 103
  • 1
  • 6
2

Visual Studio 2019 Pro -> Options -> Text Editor -> Advanced -> disable "Responsive code completion"

This disables Completion Mode, but doesn't take effect when VS is restarted. You have to enable & disable it again after each restart, which is worse than using the Toggle Completion Mode menu option.

Since it is in Options, it is probably supposed to be a permanent setting.

jk7
  • 1,958
  • 1
  • 22
  • 31
  • 2
    I tested this, it seems to illustrate a bug profile. Setting this on does nothing. Setting this off does nothing. But changing the setting causes visual studio to remember the Edit/Toggle Completion Mode, which it didn't register on startup. – Alan Baljeu Dec 14 '20 at 19:00
2

Since Visual Studio is constantly changing, I imagine there will constantly be new answers for this. None of the other answers worked for me on Visual Studio 2019 Community Edition. What did work (as of January 2022) was:

Edit > IntelliSense > Switch between automatic and tab-only IntelliSense completion

Alternatively, you can just toggle it with Ctrl+Alt+Space. Hopefully this helps someone else. Also, I've noticed Visual Studio doesn't seem to remember this setting, and I've had to toggle it again the next time I used VS.

leisheng
  • 340
  • 1
  • 8
1

For the current version of Visual Studio Code (2020), you can change to suggestion mode by going to File > Preferences > Settings and then going to Extensions > TypeScript and then checking TypeScript: Disable Automatic Type Acquisition. Or, after going to Settings, you can search for "Type Acquisition" in "Search Settings" and then check TypeScript: Disable Automatic Type Acquisition.

Sayyor Y
  • 1,130
  • 2
  • 14
  • 27
1

Default IntelliSense completion mode

Another option for VS19 Enterprise:

Visual Studio 2019 Enterprise -> Options -> Text Editor -> Advanced -> Default IntelliSense completion mode -> Dropdown -> Tab-only

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
pawelel
  • 11
  • 1
  • 5
0

I just did this in Visual Studio by going to:

File > Preferences > Settings > toggle "Suggest on Trigger Characters"

I also toggled off "Auto Suggestion on Commit Character" and "Accept Suggestion on Enter" - however you may want those settings.

user3386826
  • 327
  • 8
  • 19
0

Edit -> IntelliSense -> Switch between automatic and tab-only IntelliSense completion

In Visual Studio 2022, Edit -> IntelliSense -> Switch between automatic and tab-only IntelliSense completion.

Adriaan
  • 17,741
  • 7
  • 42
  • 75
Klyph
  • 1
  • 2