It would be really useful to be able to generate the function skeletons necessary to implement a trait for a struct. So for example, if I have the following:
trait Foo {
fn do_stuff(s: &str) -> u64;
}
struct Bar {
x: u64,
}
impl Foo for Bar {
//cursor
}
With the cursor at the indicated location, invoking the Implement Trait for Struct command would generate the following:
impl Foo for Bar {
fn do_stuff(s: &str) -> u64 {
unimplemented!();
}
}
This would be great!
Some thoughts on doing this:
impl Foo for Bar and then expanding that (I guess we could just type and select Foo and expand from there too) ; with { unimplemented! } for functionsSelf by Bar? We don't need to, I'm not sure which is more idiomatic.If I understand you correctly, RLS doesn't currently store function signatures which you would need for this. They would probably also be helpful for another feature I'd love to see: function parameter info popups.
If I understand you correctly, RLS doesn't currently store function signatures
Correct. Save-analysis can provide it (the new rustdoc will use it) but the RLS requests not to get it to save space in the data (one of the biggest sources slowdown is processing large chunks of JSON data, so this is an important optimisation). We might be able to use a slimmed down version for both functon signature assistance (which I'd also love to have) and for this feature.
Would it be possible to get "poor man's" function signature assistance by displaying the same info one gets from hovering over the function name? Mainly this is to avoid the awkwardness of moving my hand off the keyboard to hover the mouse over the function name after I type each parameter (which makes the tooltip disappear).
Would it be possible to get "poor man's" function signature assistance by...
I'm not really sure, I really need to look into function signature assistance in more detail. It's been on my todo list for a long time, but I haven't yet looked into the details.
Holy smokes! I use:
Version: 1.42.1
Commit: c47d83b293181d9be64f27ff093689e8e7aed054
Date: 2020-02-17T09:32:31.598Z
Electron: 6.1.7
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Linux x64 4.19.106-1-MANJARO
with rls-vscode 0.7.0 and I can implement the traits.
Thank you the holy gods of Rust and the contributors of rls-vscode!
By the way, did you forget to close the issue?
@erayerdin I see

@rbtcollins Sorry for the late reply. I did not prefer to write to give wrong information about my development environment.
I have VSCode installed at two machines, one has this feature while the other one, oddly, does not. I have looked at the extension pack I'm using, it definitely uses this extension. I could not understand what's different.
Most helpful comment
Holy smokes! I use:
with
rls-vscode 0.7.0and I can implement the traits.see it in action yourself
Thank you the holy gods of Rust and the contributors of rls-vscode!
By the way, did you forget to close the issue?