Improve error reporting: message when defining record with open brace on separate line
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
# what
When defining a record (and being used to brace languages):
```fsharp
type Foo =
{
bar: int
}
```
F# yields
>A type definition requires one or more members or other declarations. If you intend to define an empty class, struct or interface, then use 'type ... = class end', 'interface end' or 'struct end'.
# why
I made a "mistake" of putting `{` on its own line without indenting it
# how
I'd like the compiler to tell me how to fix the record definition:
> The record definition is invalid due to erroneous indentation, either put the opening brace on same line as type declaration or make it indented.
Note that for C# and VB.NET users (and even more for Resharper users), they'd expect the editor to be helpful with formatting, if I open `{` after `type Name =`, it should probably indent or put the brace back to the type declaration line.
I do get rants from C#/VB.NET developers about how F# editor in VS doesn't format the code while being typed and how it makes F# "unusable".
Related: #1103
Contributor guide
Assessment
This issue has not been assessed yet.