Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commit C++ Intellisense suggestion with space bar in VS 2013

I have recently been exploring C++ some after using C# exclusively for quite awhile. I'm using Visual Studio 2013 and the one thing that is bugging me to death is the inability to commit an Intellisense suggestion by pressing the space bar. I have tried to edit the commit character list in Options -> Text Editor -> C/C++ -> Advanced to accept the space bar but so far I've had no luck. Coming from C# this is very aggravating. Does anybody know if it's possible to make such a change? I know I can use Tab or Enter, but in my opinion using Space is far more fluid.

Any information would be greatly appreciated.

UPDATE: Space seems to commit some suggestions but not others. if I type "std::stri", it commits "std::string". Unfortunately, Intellisense won't commit anything created by me or even common keywords. It just adds a space after what I already typed.

like image 329
Jason D Avatar asked Dec 18 '13 21:12

Jason D


1 Answers

Further to my comment on your question, I have installed the trial version of Visual Studio 2013 (Ultimate), and can confirm that space bar does work to complete IntelliSense suggestions. Combining all comments, it would appear that it works in the following versions:

  • VS 2010
  • VS 2012
  • VS 2013

Here is a screenshot of my IntelliSense settings located at Tools > Options > Text Editor > C/C++ > Advanced:

IntelliSense settings

As a last resort you may want to try changing all your settings back to default, as suggested in this answer:

Tools > Import and Export Settings > Reset all settings

UPDATE: After reading JoshC's comments, I have experimented a bit more and I get the problem too. It appears to be related to whether or not the item you are trying to autocomplete is a member of a type or namespace. If it is (e.g. std::string) then space will work. If it is not (e.g. void) then it will not work (but for some reason, tab will work). As per this link, you can manually invoke the "List Members feature" by pressing CTRL+J in which case on a blank line it will include items which are in the global namespace - however this is clearly not a practical solution.

I have no idea why it discriminates between space and tab in this way. If anyone is aware of a workaround please let me know and I will edit this answer again.

The following would seem to imply that there is no solution for C++:

http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2656132-support-committed-by-pressing-the-space-bar-in-c

When using Visual Studios 2012 for coding in C++, how do you autocomplete code selected in IntelliSense? (see comments)

like image 199
JBentley Avatar answered Oct 19 '22 23:10

JBentley