dotnet / dotnet/roslyn

Multiple spaces within line as configuration option

Open
#79,093 0 comments 0 reactions 0 assignees View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

## Summary

Please consider either:

- adding an option to `.editorconfig` or VS Code settings that _allows multiple consecutive spaces_ within a line to be preserved,
**or**
- providing a simple way to disable formatting for specific C# code blocks (e.g., via custom `#pragma` directives or special comments).

## Background and Motivation

Currently, the formatter strictly removes multiple spaces within a line, which makes it unnecessarily difficult to create certain layouts—such as table-like structures or intentionally aligned initializations—that improve _readability_.

Vertical alignment has a long tradition in C and C++, so coming from there, it feels strange that it seems no longer allowed in C# even when explicitly wanted, only because multiple spaces _may_ be considered as clutter in some coding guidelines.

## Proposed Feature

I suggest making the automatic C# code formatting in Visual Studio Code more flexible and configurable. Not all companies follow the strictest coding rules, but leave a little freedom to the developers.

Such features would be especially valuable to developers who place great importance on clear visual alignment beyond standard guidelines.

## Alternative Designs

Other tools like Eclipse or ReSharper already have been offering more flexibility in this area (by formatting _less_ by default).

Thank you for your excellent work—I hope this feedback is helpful and taken into consideration.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.