Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, July 16, 2019 2:31 PM | 1 vote
I am using Visual Studio 2017 and auto-completion is a very useful feature. Except that in most editors it is triggered using either Enter or Tab key or both. In Visual Studio 2017 for some reasons it also works with space bar. This is extremely inconvenient because sometimes I type a variable name first and then add a type. This works fin in most editors, but in Visual Studio as soon as I press space bar, variable name turns into a type which may be a few dozen characters long and takes forever to delete. Is there a way to change auto-completion behavior so that it only triggers on Tab and/or Enter key?
All replies (10)
Tuesday, July 16, 2019 6:30 PM
I'm afraid that disabling the space would change how auto completed worked. Using enter or space for auto-complete doesn't even make sense to me. Intellisense job is to save you from typing stuff. As you are typing, as soon as it narrows down to what you want you space to insert and you're moving on to the next thing. Enter doesn't make sense here.
1. Type `pub` and Intellisense selects `public`.
2. Press ENTER and `public` is inserted and you move to the next line.
3. Backspace to go to previous line and type `cl` and Intellisense selects `class`.
4. Press ENTER and 'class' is inserted and moves to the next line.
5. Backspace...
If you do things out of order then you're fighting the system. In some cases this may make sense but it shouldn't be the norm. Especially with a type you are basically preventing Intellisense from doing anything useful for you. It would be better to just turn it off at this point. Let's imagine this scenario.
1. Type `id` and Intellisense will see if there is anything that matches it. Note that it won't auto-complete to anything other than `id`. If it does then that is a bug. In VS 2019 RTM and an update or two after that this was a bug but it was fixed in a later update. If you type something Intellisense cannot match and you press space it just moves on.
2. You continue typing but at this point Intellisense (correctly) assumes `id` is a type name and is now giving you suggestions for identifier names, not suggestions for what you want to do with the variable.
3. Now you try to do something with `id` but Intellisense doesn't know what it is so if you do `id.` then it doesn't have any useful suggestions. If you try to pass `id` to a method then it reports an error about the parameter not being correct. You might as well disable Intellisense at this point.
If you don't know what the type should be, and in many cases even when you do, use `var`. You can correct it later (which you'll have to do if you leave it off anyway). If `var` won't work, such as in field or parameter definitions, then use `object` instead. Again, you'll be correcting it later anyway but Intellisense will understand what you're doing.
Michael Taylor http://www.michaeltaylorp3.net
Tuesday, July 16, 2019 8:33 PM
When I found that hitting the spacebar to insert a space was causing Intellisense
to auto-insert something I didn't want, I noticed that in most cases it was
choosing the highlighted (selected) item from a dropdown list of suggestions.
I then got in the habit of watching for that dropdown when I was about to enter
a space character (hitting the spacebar) and hitting Escape first before the
spacebar. That closes the dropdown list of suggestions and the spacebar just
inserts a space character as desired. YMMV
- Wayne
Thursday, July 18, 2019 9:47 AM
Hi Aleksey,
Do you have any updates? We cannot just disable the space bar to auto complete word, when we type and it will auto select one available member from the Member list drop-down. You can go to Edit-Intellisense and click the "Toggle Completion Mode" to disable the auto pre-select, then when you type the code, it display as below and press space bar will not auto complete and just display the word your typed:
Best regards,
Sara
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected]
Thursday, July 18, 2019 1:41 PM
I am not a good typist. I usually look at the keyboard when I type. Then, after typing a portion of code I look up on the screen and it is very annoying when I see something entirely different because of the auto-complete feature.
Friday, July 19, 2019 9:22 AM
Hi Aleksey,
Please open Tools -> Options -> Text Editor, then select the development language, disable "Auto list members"
For example, disable it for C#
Hope it can help you.
Best Regards,
Dylan
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected]
Wednesday, July 24, 2019 1:10 PM
Thanks, but this checkbox will completely turn off this feature. I think it is a very useful one and I use it a lot. I just want to have control over when I want to accept a suggestion and when I do not. I guess this is not possible. Sorry about that.
Thursday, July 25, 2019 5:05 AM
Hi Aleksey Malyshev,
Sorry for this inconvenience,
If you have other issue about VS IDE, please feel free to contact us, then we will try our best to provide a solution.
Have a nice day.
Best Regards,
Dylan
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected]
Wednesday, October 16, 2019 11:47 PM
"Could I be wrong? No, it is the users who are wrong, they must be using my software wrong!"
This is a prime example of stubborn designers who refuse to admit that maybe, MAYBE, other people don't work the same way they do. What if I run a function that returns an error code, then afterwards, decide I want to cout the error code? I go back to the start of the line, I write std::cout, and as soon as I hit space, it erases the function call. What if I realise I was supposed to nest my function call in another function call? I go back to the start of the function call, I write the outer function call name, and before you know it, I've lost the original function call! If I don't notice, it doesn't throw an error, it JUST PRODUCES THE WRONG CODE.
I and many others have serious problem with being unable to use the IDE how we want to, and the fact that you have the nerve to tell someone "oh, you're just doing it wrong" infuriates me, and makes me hate you and this IDE.
Wednesday, October 16, 2019 11:49 PM
Are you going to work on this issue? All I've heard here is "go away, I don't care". This is one of many threads strewn across the internet about this issue, so where's our resolution? Our promise that it's being looked into?
Thursday, April 16, 2020 2:40 PM
"this checkbox will completely turn off this feature"
...but Ctrl+Space works. Only when I want it :)