News for hackers. Stuff that matters.
Re:Try Out Rust IDE Support in Visual Studio Code by saghm on Friday August 18, 2017 @10:54PM (#15051390)
> I can't get any dot-completions on vpt > Even more weird is that if I add a type declaration to "let vpt" (specifying the same type that would be inferred), then completion works

I'm fairly certain the reason for this is that RLS (and every other Rust editor/tool I've tried) isn't able to handle completions for things coming from macros (transitively or otherwise). Although the prevalence of the `vec!` macro might make it seem like the completion is "extremely basic", variables coming from macros are pretty much the only case I've found that RLS can't completely properly for. If you manually write the code that the macro would produce (i.e. `{ let mut temp = Vec::new(); temp.push(pt); temp }`, I think it should work fine.

Re:Try Out Rust IDE Support in Visual Studio Code by tomjakubowski on Saturday August 19, 2017 @02:01AM (#15051934)
It might also help to manually annotate the type of the binding being assigned to.

            let v: Vec<i32> = vec![ pt ];
            let vpt = &v[0];
Re:Try Out Rust IDE Support in Visual Studio Code by int_19h on Saturday August 19, 2017 @04:14PM (#15055335)
Nope, doesn't help (corrected to Vec<Point>). The only thing that works is annotating the vpt binding itself.

In any case, if you have to annotate all local bindings for completion to work, that's not idiomatic Rust anymore.

Another interesting thing that I've noticed, is that it does know what vpt.x and vpt.y are - when hovering over them, it correctly says that they're i32. So the type inference works as it should. It's specifically completion that is broken here for some unclear reason.

Re:Try Out Rust IDE Support in Visual Studio Code by saghm on Saturday August 19, 2017 @07:31PM (#15056198)
I wonder if this is an issue with the VSCode extension rather than the RLS then; all RLS can do is provide information to the extension, so maybe the extension just isn't using the information.
Re:Try Out Rust IDE Support in Visual Studio Code by int_19h on Saturday August 19, 2017 @04:11PM (#15055320)
It's not an issue with vec! - the same problem occurs if I use Vector::new and push. It seems to be a problem with the vector itself, or perhaps indexing.

Besides, it does know the type of vpt in code snippet above - like I said, when I hover about it, it correctly tells me that it's &Point. So it clearly can handle macros, or at least vec! specifically.