When a line is partially selected, this results in /**/ C-style comment:
#include /*<assert.h>*/
#include <stdlib.h>
#include <node.h>
When one or several lines is partially selected, this results in // C++-style comment:
//#include <assert.h>
//#include <stdlib.h>
#include <node.h>
All VS2019 comment options have this behaviour: Toggle Line Comment (Ctrl+K, Ctrl+/), Toggle Block Comment (Ctrl+Shift+/), Comment Selection (Ctrl+K, Ctrl+C).
Do these options behave differently in other languages?
I'm aware of C++-style comment drawbacks but would like to be able to use them for multiline comments where needed:
/*
#include <assert.h>
#include <stdlib.h>
*/
#include <node.h>
Is it possible to configure Visual Studio 2019 this way?
There are other similar questions but they refer to older VS versions and answers seem to be outdated.
As far as I'm concerned, you should select the whole line (i.e. from the very first character of the line) in order to use c++ comments for multiple lines.
If there are comments among the selected lines, Ctrl+K,Ctrl+C will generate C++ style comments even if the selection does not start from the beginning of the lines.
For example:Select the content as shown:

And then Ctrl+K, Ctrl+C

If you select the whole line including spaces:

And then Ctrl+K, Ctrl+C,you will get C++-style comment for multiline comments

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With