Mose
Mose

Reputation: 1821

Visual Studio -> wrap every parameter

Using Visual Studio 2019, I found a really useful refactoring option in 'Quick actions and refactoring': (might come from PowerTools, whatever)

enter image description here

I just wondered how:

For the later, a solution with Visual Studio Code would be perfect as well !

Thanks for your help

Upvotes: 10

Views: 4142

Answers (2)

Andrew D. Bond
Andrew D. Bond

Reputation: 1280

... apply this formatting on my whole solution at once ...

You can apply this formatting to an entire document at once with the free CodeRush Visual Studio extension. https://www.devexpress.com/products/coderush/

After installing the extension, use the CodeRush Format Document action.

Alternatively, you can automatically format on save from CodeRush > Options > Editor > C# > Code Cleanup:

  • Apply Code Cleanup when savings a document
  • Code Style > Apple CodeRush formatting > Apply On Save

If needed you can also customize the wrapping in the C# > Formatting > Wrapping options area.

For a solution-wide analyzer, there is an open issue for this at https://github.com/dotnet/roslyn/issues/59927

Upvotes: 0

Tomer
Tomer

Reputation: 1568

You can try using Rewrap extension which formats code, comments, and other text to a given line length (80 by default).

The main Rewrap command is: Rewrap Code / Comment, by default bound to Alt+Q. Put the text cursor inside a comment line, block or plain text paragraph and invoke the command to wrap. You can also select just a few lines, or multiple comments in one selection.

There is currently an Open request for this in the VS Code Issue tracker on GitHub

Upvotes: 2

Related Questions