FsAutoComplete
FsAutoComplete copied to clipboard
The record generator for anonymous records.
Sample code:
let x () : {| A: int; B: string |} =
{| A = 123 |}
The error message on the second line: Two anonymous record types have mismatched sets of field names '["A"; "B"]' and '["A"]'
.
Having info present in error message we should be able to generate stub for missing fields just like in case of normal records
I would like to tackle this. Do you know where the stub for the missing fields for regular records is created?
The current record stub generation code is found src/FsAutoComplete.Core/RecordStubGenerator.fs
, and the place it's called is the GetRecordStub
member in src/FsAutoComplete.Core/Commands.fs
. My guess is that shouldGenerateRecordStub
needs to be updated to apply to anon records with 'missing' fields, and formatRecord
would need to be updated as well.
Is there a Tool or Documentation to visualize the AST of F# Source Code to improve my understanding of the differences between a RecordExpression and an AnonRecordExpression?
Yep! There's a good one over at https://jindraivanek.gitlab.io/ast-viewer, and a slightly-less good one at sharplab.io.