Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable undesirable auto-complete with Visual Studio + ReSharper?

I'm using Visual Studio 2010 and ReSharper 5.

I define this at the top of a .cs file.

#if X86 using size_t = System.Int32; #else using size_t = System.Int64; #endif 

Then I can use size_t and know that it is a native integer, 32 bits if compiled as a 32 bit assembly, and 64 bits if compiled as a 64 bit assembly. (for those that are curious, the alternatives are always use Int64, or branch at runtime on IntPtr.Size == 4 and have two versions of the code. I prefer this solution.)

However, if I type size_t and hit space, it will be automatically converted to Int64 (or Int32 if X86 is defined). Obviously that's undesirable.

I went into ReSharper options and went to Environment \ Intellisence \ Completion behavior and disabled all the checkboxes under "Automatically complete single item with:".

It still happens, is there anything else I can try?

like image 569
Eloff Avatar asked Apr 09 '11 18:04

Eloff


People also ask

How do I get rid of autocomplete code in Visual Studio?

By default, VS Code shows snippets and completion proposals in one widget. You can control the behavior with the editor.snippetSuggestions setting. To remove snippets from the suggestions widget, set the value to "none" .

How do I turn on autocomplete in Visual Studio?

The suggestion list of Automatic completion appears as soon as you start typing a new identifier. The suggestion list of Basic completion appears when you press the default Visual Studio IntelliSense shortcut Ctrl+Space .


2 Answers

I ran into a similar issue (using VS2013 and Resharper 8.2).

To stop the undesirable auto-completion on every "space" hit, I had to disable IntelliSense completion on "space" both within VS and R# options:

  1. VS > Tools > Options > Text Editor > C# > IntelliSense > "Committed by pressing the space bar" checkbox
  2. VS > Resharper > Options > Environment > IntelliSense > Completing Characters > C# "Complete on space" checkbox

Cheers!

like image 56
bobocoder Avatar answered Oct 14 '22 00:10

bobocoder


One solution would be to toggle to suggestion completion mode for intellisense. The default key binding for the toggle is Ctrl+Alt+Space. When in suggestion mode, it will only change what you type if you explicitly choose a value to change to. You can read more about it here:

http://blogs.msdn.com/b/zainnab/archive/2012/05/01/9943045.aspx

In the VS2017 menu hierarchy the suggestion mode can be found under:

Edit -> Intellisense -> Toggle Completion Mode 

Additionally when the suggestion mode is enabled, it is visually indicated by the following button (and can also be enabled/disabled by clicking the button):

visual studio 2017 suggestion mode button

like image 41
Malgaur Avatar answered Oct 13 '22 23:10

Malgaur