In the project I am working on, I am tasked with forcing line character width to 140 characters for a line of code in the visual studio editor. Unfortunately, to my research, any roslyn based analyzer does not support this feature. Can you please lead me a way to achieve this, it could be writing custom rules or what?
Asked
Active
Viewed 568 times
0
-
1Could you please explain what you mean with "line"? Is this a file or textarea or Some another thing? Thanks – Ozan BAYRAM Jul 07 '22 at 09:55
-
1A line of code in the VS Editor. – bugrasitemkar Jul 07 '22 at 09:56
-
See: [Adding a guideline to the editor in Visual Studio](https://stackoverflow.com/questions/84209/adding-a-guideline-to-the-editor-in-visual-studio). – Olivier Jacot-Descombes Jul 07 '22 at 09:59
-
There's a long standing [open issue](https://github.com/dotnet/format/issues/246) about supporting EditorConfig's `max_line_length`/`rulers` in `dotnet format` – fuglede Jul 07 '22 at 10:04
1 Answers
1
You could add the Editor Guidelines extension into Visual Studio:
https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelines
I find it helpful to visually limit the length of lines of code, but it's not an automatic enforcement.

Olivier Jacot-Descombes
- 104,806
- 13
- 138
- 188

Ben Wesson
- 589
- 6
- 16