Home > Back-end >  What does the settings "Insert // at the start of new lines when writing // comments" do?
What does the settings "Insert // at the start of new lines when writing // comments" do?

Time:08-11

The title.

enter image description here

It's in Visual Studio > settings > text editor > c# > advanced > comments.

(Hint: It does not add // when writing comments.)

CodePudding user response:

What this feature is supposed to toggle is while editing a single-line comment, if you insert a newline in the middle, the next line (with remaining text) will continue the comment. For example, inserting a newline at the | in // foo|bar becomes

// foo
// bar

Without this, it would be

// foo
bar

The Split String Literals option that @StriplingWarrior mentioned in the comments is similar but specific to strings. "foo|bar" becomes

"foo"  
"bar"

As for why the option doesn't do anything, StriplingWarrior was also spot on. The code for this is in the Roslyn repository on GitHub, so:

TL;DR: it's a handy feature, and there's a bug that you can't turn it off.

edit: issue opened here

  • Related