@wilfredh Is that what rust-analyzer does? I think I'm usually unsatisfied with the parameter order, but it's probably more important to make it easy to swap/reorder parameters than to get everything right on the first try.
@arxanas I'm not sure what r-a does, although I've also been surprised occasionally with the parameter order.
I don't recall a refactoring in rust-analyzer to reorder parameters though. In fairness it's hard to build: reordering is much nicer in a GUI, which doesn't map well to LSP.
Wilfred Hughes
@arxanas @mattbrowndev Just noticed that rust-analyzer has started doing exactly this!
https://github.com/rust-lang/rust-analyzer/issues/18639Wilfred Hughes
@wilfredh @mattbrowndev Oh, nice, I'll be interested to try it out and see if it makes a noticeable difference.
[tangential] In several codebases, I've wanted a lint rule/configuration that would let me establish a partial ordering for parameters of certain types and/or names to enforce consistency, but I haven't found any tool for any environment that would let me do it (and I haven't written one myself 😫).
The information about desired parameter ordering *exists*, to some degree. It's just unfortunate that it's hard to write down. (Also, if you wrote down what you thought the rules were for a certain codebase, you might discover that your intuition is actually unsatisfiable in certain cases.)
Obviously, we can just throw an LLM in there to help 🤓
@arxanas @mattbrowndev I can definitely see the appeal of such a lint! After a little googling, I'm surprised that there's no (obvious) eslint plugin for this, considering the size of the eslint ecosystem.
Claude does generate something plausible-looking when I ask for an implementation though:
https://claude.site/artifacts/e48e2c52-c063-4351-b97d-d15748109290Wilfred Hughes