ispiro
ispiro

Reputation: 27693

What does the settings "Insert // at the start of new lines when writing // comments" do?

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.)

Upvotes: 1

Views: 130

Answers (1)

Jimmy
Jimmy

Reputation: 28396

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

Upvotes: 2

Related Questions