Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Visual Studio, is there a way to word-wrap ONLY comments?

Tags:

I've looked, but it doesn't look like you can apply specific formatting to just comments.

like image 495
Deane Avatar asked Mar 26 '10 16:03

Deane


People also ask

How do you wrap comments in VS Code?

Quickly turn on/off word wrap in VSCode You can toggle word wrap for the VS Code session by pressing a key combination. On Windows or Linux, simply press Alt+Z. On MacOS, you can also press Option ⌥ + Z. Alternatively, one can enable/disable word wrapping by selecting View > Word Wrap from the Menu.

How do I make word wrap default in VS Code?

Set Word Wrap GloballyGo to File > Preferences > Settings and type in “word wrap” in the Search settings field. Then, where it says Editor: Word Wrap, select on from the drop-down menu. That's it!


2 Answers

Well, there is an Add-In which will automatically format your comments to a given width (as a side feature).

It is HyperAddIn - the main feature of which is allowing you to create 'hyperlinks' to other places in your code within comments, like this:

// The other half of this logic is in code:ComponentManager.Initialise()

With HyperAddIn installed, the code:ComponentManager.Initialise() becomes a clickable link.

I have it installed, it works OK, but I must admit that most of the time I don't have the comment formatting switched on.

like image 142
Benjol Avatar answered Sep 24 '22 13:09

Benjol


No. The shortcut is Ctrl+E, Ctrl+W.

There would be one trick how to format the comments. Write your own code snippet for the comment.

like image 45
nubm Avatar answered Sep 23 '22 13:09

nubm