7

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.

Jason D
  • 2,634
  • 6
  • 33
  • 67
  • I haven't used 2013, but in 2010 I can use space. However, I got used to tab instead, as no other editor seems to use space. It makes my life easier when not using VS. – David Dec 18 '13 at 21:55
  • If there's no solution I'll get used to using tab. It's gonna take a bit of mental rewiring after coding in C# exclusively for over a year... I guess it is what it is though. – Jason D Dec 18 '13 at 22:03
  • I can confirm that space works for me in 2012. I do not have a copy of 2013 to test it unfortunately. – JBentley Dec 19 '13 at 01:31

1 Answers1

3

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)

Community
  • 1
  • 1
JBentley
  • 6,099
  • 5
  • 37
  • 72
  • This is bizarre. My settings were identical to yours, with the exception of `Member List Commit Aggressive` being set to true, yet space didn't commit a suggestion. Even after resetting all settings, it still doesn't. I have no idea what's causing this. – Jason D Dec 19 '13 at 18:38
  • 1
    I just tested this. If you Ctrl+Space to get your member list space will commit. If you merely start typing, I am in the same boat, space will not work. I am currently searching for a way to get the latter to work. – Josh C Dec 20 '13 at 01:13
  • @JoshC I can now see what the problem is (and one solution, albeit not one that I consider useful). Answer updated. – JBentley Dec 20 '13 at 02:40
  • Somebody should try to report this as a bug to the VS2013 dev team – Josh C Dec 21 '13 at 02:10