Stop default Autocomplete behavior when hitting spacebar in Visual Studio 2015

倖福魔咒の 提交于 2019-12-03 04:33:38

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."

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

"editor.acceptSuggestionOnCommitCharacter": false

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

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.

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

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.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!