Ary Borenszweig wrote:
>>> Is that what you mean?
>>
>>
>> No :(
>> Templates are designed to do compile-time magic based on their input
>> arguments. Currently, I can't see that magic in the compile-time view.
>> The templates I looked at were still template foo(T) instead of somehow
>> showing the bodies for foo!(int) and foo!(char)
>
> I can't expand every template instantiation because then it will be a
> mess, and the code formatter also won't work.
>
> You can try pressing ctrl+shift and hovering the template instance. It
> should show you it's content (removing false static ifs and stuff).
>
> Is this what you mean? Can you provide an example?
I have no great example handy, but I tried doing the equivalent of this example
(dmd 2.022):
import std.algorithm;
void main(){
auto x = sort!("a<b")([2,3,5,4]);
}
Sadly, nothing happens with the ctrl+shift+hover trick. The compile time view
reports it as missing. I checked the user libraries to make sure it was ok. I
have two: druntime and phobos. The phobos path displays as
usr/local/src/phobos (I navigated to /usr/local/src/phobos through the gui to
select it). I see the std subdirectory and algorithm.d inside of it. I don't
know what is going wrong with finding the import.
sort is really a wrapper around sortImpl, which has two bodies inside a static
if. It's trivial to figure out which one is used, but it'd be nice to have a
way to see what was really done without all the static if's.