fantomas
fantomas copied to clipboard
Add doc comments in SyntaxNode.fs giving an example of what each node looks like
As a contributor who hasn't spent a ton of time in the F# compiler interacting with the AST, I often find myself unsure of what a given node looks like in practice, and I have to do a lot of trial & error (usually in fantomas-tools) checking things to see what node matches what text. I feel like it would be super helpful to new and existing contributors to have a minimal example for each non-trivial node.
For example:
/// Example:
/// `fun x -> x`
type ExprLambdaNode(funNode: SingleTextNode, parameters: Pattern list, arrow: SingleTextNode, expr: Expr, range) =
inherit NodeBase(range)
This could be especially useful for some more complex or less intuitive nodes and those with compiler-centered abbreviations (e.g. PatIsInstNode
, ExprAppNode
).
I believe this could help encourage newer contributors and also help current contributors understand the codebase and patterns better.