Nice! I do still wish we had holes in Rust… would be super nice for the match arms/patterns ; _ ;
Conversation
This Tweet is from a suspended account. Learn more
Yeah, that's what I do - feels a bit hacky though, and can't really put them in patterns. Also can't use them interactively for case splitting etc. like in Agda, Idris, Haskell, etc.
1
1
Like, it's a tad annoying when rust analyzer has to generate code that doesn't type check or even parse 😢
1
One example is function completion, where it inserts a function call with argument names pulled from the parameters (which may not exist in scope). It would be super nice if it inserted a function call with a bunch of holes that you could jump to and fill interactively… 😅
2
I personally disable this feature (`"rust-analyzer.completion.addCallArgumentSnippets": false`), as find it more distracting than useful. Parameter info popup and completion, if done right, should work just as good as holes.
Sadly, param info in code is
1
1
Hmm, still seems like it generates broken code though? Like, it produces:
make::use_item(make::use_tree())
rather than something like:
make::use_item(make::use_tree({! !}, {! !}, {! !}))
Same goes for `match`, where this stuff becomes even more useful!
3
>Same goes for `match`, where this stuff becomes even more useful!
For match actually, I feel like `_` can play a syntactic role of a hole? "Split _" 💡is totally doable (but is not implemented yet).
1
Yeah, Purescript and Haskell use `_` for holes, but you can name them, which lets you distinguish them in error messages/editor support: downloads.haskell.org/~ghc/7.10.1/do
2
This Tweet is from a suspended account. Learn more

