fsharp / fsharp/fslang-design

[style-guide] Better control of pattern match handlers and line breaks.

Open
#650 34 comments 2 reactions 0 assignees View on GitHub
style-guide style-guide-decided
Dominant language
F#
Stars
557
Forks
149
Avg merge
4d 13h
Merged PRs (30d)
2

Description

### Description

I would like to suggest having an option for pattern matching that could be set to one of four ways:

1. **Current behaviour**: Whatever this is exactly ;-)
2. **Prefer newlines**: Always have the clause handling on a new line and indented.
3. **Prefer same line**: If the pattern match handler is small enough, put it on the same line as the handler.
4. **Consistent** mode: Prefer same line, but *only if all matches can fit on the same line*. Otherwise, prefer newlines for all cases (i.e. fallback to option 2).

I'm not sure if this ideas are feasible or not - just thinking out aloud at a number of different styles we see in the wild (my personal preference is 4).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.