Add a mechanism for renaming anonymous structs#204
Conversation
kubukoz
left a comment
There was a problem hiding this comment.
btw. it'd make sense in sn-bindgen too, in a user-provided way
| given Render.Config( | ||
| indents = Indentation(0), | ||
| indentSize = IndentationSize(2), | ||
| // todo: these are currently in a global namespace, which is kinda bad? |
There was a problem hiding this comment.
didn't spend enough time with the codebase to have a clue if a struct's renderer knows its FQN, so I went with this for now. It works by a miraculous stroke (of luck) as ByCells/ByDocumentAndCells both have the same structure.
| val newTypeName = "S" + inlineAnonymousStructures | ||
| val newTypeName = summon[Config].anonNameOverrides | ||
| .get(structure.name.value) | ||
| .fold("S" + inlineAnonymousStructures)( |
There was a problem hiding this comment.
technically these S names don't happen anymore, but this is here to account for new types being added in future LSP versions and the maintainer not wanting to give them names immediately.
There was a problem hiding this comment.
Actually I think it's worth being strict here – better to fix the names once during update, than to expose S* and then have to break source compat renaming them.
There was a problem hiding this comment.
not completely unreasonable
Thoughts? The names may not be the best, but we can bikeshed them and they're probably still better than S0/S1.