snippet support for records - why not start at NamedFiedPuns?
Opened this issue · 2 comments
Currently, the snippets for records generate things like this:
Foo {foo = _foo}
I don't like that because if there are multiple fields, I need to delete tons of placeholders (and I usually don't go through them by tabbing) and it works really bad with fields that e.g. follow the _ lens convention (because then it generates things like Foo {_foo = __foo} which is even more noise.
Is there a specific reason why we couldn't start at NamedFieldPuns ala
MkFoo {foo, bar, baz} and then let the user extend if they want to give their fields an alias?
Thank you ~
This would also avoid the issue that the formatting doesn't adhere to your conventions nor formatter when you using the snippet
Thank you for the issue!
Is there a specific reason why we couldn't start
There is no reason, just a discussion to be had about user experience and workflows :)
I feel like this is context dependent. In pattern matches, what I can imagine could be better is to generate Foo { } and move the cursor between the { and }. Then a completion request could offer to insert all fields, e.g. via NamedFieldPuns, or you could complete a single record field name.
Perhaps something like this would also work nicely for constructing records?
Your suggestion makes sense to me, but I am not feeling strongly about this behaviour either way.