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.
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
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.
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
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.)
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
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.
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.
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:
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.
Default IntelliSense completion mode
Another option for VS19 Enterprise:
Visual Studio 2019 Enterprise -> Options -> Text Editor -> Advanced -> Default IntelliSense completion mode -> Dropdown -> Tab-only
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.
Related
Using c#
My Visual Studio suddenly stopped autocompleting me while I write.
for clarification, it does show me the normal completion options but it doesn't highlight the best one, meaning I can't just click enter and it will complete for the best match.
example:
when I write "flo", it suggests "float" but I can't just click enter and it will auto-complete.
any suggestions?
example: when I write "flo", it suggests "float" but I can't just click enter and it will auto-complete.
It sounds like you want the other Intellisense mode, the option is called "toggle IntelliSense suggestion/completion mode" and in the C# configuration the shortcut is Ctrl+Alt+Space:
I am trying to solve problem with typing '>' character in Visual Studio. When I press the key nothing happens. The key works in all other applications, but not in Visual Studio.
I have tried install the Visual Studio 15 (the new test version), but even that didn't work. Any ideas?
Let me guess, you're using a non-English keyboard layout? One that uses AltGr+. for ">"?
The problem seems to be with Visual Studio 2015 Update 2, which creates a key shortcut for the Ctrl+Alt+. key combination. Resetting your settings will not help, since this is now one of the default shortcuts. Reinstalling or repairing your Visual Studio installation similarly won't help.
What you have to do is remove the problematic key shortcut - go to Tools, Options, Environment, Keyboard, search for command "EditorContextMenus.CodeWindow.QuickActionsForPosition". You will notice it's assigned to the Ctrl+Alt+. shortcut. Remove it and your ">" should once again work.
You can reset your Environment Settings as said here
To reset your settings
On the Tools menu, click Import and Export Settings.
On the Welcome to the Import and Export Settings Wizard page, click Reset all settings and then click Next.
If you want to save your current settings combination, click Yes, save my current settings, specify a file name, and then click Next.
—or—
If you want to delete your current settings combination, choose No, just reset settings, overwriting my current settings, and then click Next. This option does not delete default settings, which will still be available the next time you use the wizard.
In Which collection of settings do you want to reset to, select a settings collection from the list.
Click Finish.
The Reset Complete page alerts you to any problems encountered during the reset.
If the above still doesn't works, then follow this:
Press the Alt button from your keyboard and type in 62 from your NUMPAD
Alt + 62
Visual Studio allows you to remap almost any key combination to any command. It's fairly easy to cause havoc by rebinding a commonly used key to something rather innocuous via the Tools > Options dialog:
And given the sheer number of commands VS offers, trying to figure out which command it was bound to is nearly impossible is like searching for a needle in a haystack. The nuclear option is just to reset everything back to factory defaults (I assume that's okay with you since you've tried re-installing). However, if you want a more surgical approach you can manually edit your settings (usually under Documents\Visual Studio <X>\Settings\CurrentSettings.vssettings) and look for a line like this:
<KeyboardShortcuts>
<UserShortcuts>
<Shortcut Command="Window.PinTab" Scope="Global">Shift+.</Shortcut>
</UserShortcuts>
</KeyboardShortcuts>
And just remove it the shortcuts you'd like to get rid of. (You'll probably want to use an editor like Notepad++ that will reformat the XML for you to edit it more nicely). How this happened in the first place isn't clear. Unless you knew about this dialog to begin with, it's hard to see how you could have added this shortcut. I think someone may be playing a trick on you.
I am trying to make VS 2013 stop putting my opening braces on new lines when the code block is not a type. I've gone to Tools -> Options -> Text Editor -> C# -> Formatting -> New Lines and unchecked everything except new lines for types, query expression clauses, and the keyword options.
I hit "OK", and VS STILL keeps putting ALL my opening braces on new lines every time I finish a statement or block or otherwise trigger an auto format. I've even tried restarting VS. No luck.
The settings SAY that they are set to what I wanted, but Visual Studio refuses to obey them. EXTREMELY frustrating. Can anyone help?
Thanks to Lucas Trzesniewski in the question comments, the problem has been found and solved: ReSharper.
I'm working on a machine that another dev was using before me. They installed ReSharper into Visual Studio, which overrides VS's settings with its own. I didn't even know that ReSharper existed--hence my confusion.
For anyone else who didn't know about ReSharper, here's how to set up your opening brace formatting:
Go to Tools -> Options. In the collapsible lists on the left, go to ReSharperPlatformVs12 -> General and click the Options... button that appears on the right.
There will be another set of collapsible lists on the left of the window that pops up. In these, go to C# -> Formatting Style -> Braces Layout.
On the right side, you should find a set of options in a collapsible "Braces Layout" list, each with a drop-down full of all the many ways you can make it treat opening braces for that option. Go ham and set them how you wish :D
I am trying to put line numbers in Visual Studio.
Usually I go for
Tools -> Options -> Text Editor -> C#
A new machine was assigned to me with preinstalled VS 2008. I am unable to find the C# option.
Any solution ? Thanks in Advance
First, you need to check the box labeled "Show all settings" in the lower left-hand corner.
Then, you can expand "Text Editor", select "C#", and check "Line numbers". (You can also enable this setting for all languages, rather than individual ones, if you prefer.)
And while you're at it, you probably want to crank up "Animate environment tools" to the max. No point in waiting around on the IDE to show pretty animations when you have code to write!
Check the "Show All Settings" checkbox at the bottom of the dialog. It should then show all supported languages, although you may be better setting "All Languages" rather than setting it for each individual language..
What is the keyboard shortcut to get CodeRush to do the #1 suggested fix for the situation?
Do I really have to hover over the problem long enough to get the ellipse to show up and then pick a choice?
Also is there a way to jump to the next problem area?
In the DevExpress options (under DevExpress > Options), there's a "IDE" section and a "shortcuts" subsection.
In there, you probably already have a keyboard shortcut defined for in the "Refactor" category for the "Refactor" command - that keyboard shortcut would bring up that selection box, and pressing Enter will then select the first option in that dialog box, by default.
If you notice a delay contact support#devexpress.com and send some details to help us reproduce. Also, CodeRush doesn't interfere with Intellisense, but uninstalling other third-party IDE tools has been known to suppress Intellisense and this may be what happened to you. Try this: Open up the Visual Studio Tools menu then Text Editor and then C#. On that options page you will need to recheck "Auto list members" and "Parameter information" to get Intellisense reenabled.