Add desugared type to hover when the desugared type and the pretty-printed type are different.
c++ template<typename T> struct TestHover { using Type = T; }; int main() { TestHover<int>::Type a; }
variable a
Type: TestHover<int>::Type (aka 'int')
Differential D114522
[clangd] Add desugared type to hover lh123 on Nov 24 2021, 3:21 AM. Authored by
Details Add desugared type to hover when the desugared type and the pretty-printed type are different. c++ template<typename T> struct TestHover { using Type = T; }; int main() { TestHover<int>::Type a; } variable a Type: TestHover<int>::Type (aka 'int')
Diff Detail
Event TimelineComment Actions I agree we often show the wrong amount of sugar, and with the thrust of this patch. Some pareto-improments are possible with a single type, but we can't solve this problem satisfactorily:
However I think desugaring all the way to the canonical type, and showing it whenever the strings are not exactly equal, are too blunt as policies. I'd suggest we expose that function from ASTDiagnostic.h and use it for this purpose.
Comment Actions This looks pretty good in terms of behavior, some impl comments but we should land this. My main remaining concern is just that this will trigger too often when there's no confusion over types, and clutter the display.
@kadircet hopefully has thoughts on what hover should look like
Comment Actions
As discussed offline I share these concerns, and it's not the first time we're facing them. I am afraid that this might be disturbing for a good fraction of users if we don't polish it around common types.
Comment Actions Thank you! (& Sorry for the delay, have been sick) As noted below I'd suggest either disabling aka for params, or reverting to the previous version, but I don't feel strongly.
Comment Actions BTW this seems hard to implement well without invasive changes to the desugar logic. Nontrivial case: the list is {std::string}, the type is std::string*. Pathological case: the list is {std::string}, and the type is pair<std::string*, size_t>. Desugar yields pair<basic_string<char>*, long long>, desired output is pair<std::string*, long long>.
|