Description
Description
From #2286 (comment)
Hmm, it’s not easily possible in the current design where we assume all nodes for the Fix-It to already be present in the syntax tree so that we just need to flip the token presence.
I would say that it’s good enough for now but adding support for these kinds of Fix-Its might be useful in general. What we need for that is, IMO, a new
Fixit.Change
that takes a syntax node, a key path within that node and a replacement node, i.e. something likecase replace<NodeType, ChildType>(node: NodeType, path: KeyPath<NodeType, ChildType>, child: ChildType
) – and yes I see the irony of declaring a generic enum case here, you would need to come up with some design that actually compiles, I haven’t thought about it too much yet.
I think this kind of Fix-It change might also be useful for macro authors. IIRC it came up once or twice but was never super important.