[PATCH] D93227: [clangd] Smarter hover on auto and decltype

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 15 07:30:04 PST 2020


sammccall added a comment.

Thanks! This seems more consistent with our other hovers, but is going to be better-formatted/more attractive in VSCode.
There are a couple of wrinkles I'd like to discuss :-)

Brevity
-------

This is clear and mostly consistent (documentation excepted), but uses three lines where clearly two would do - the "auto" title provides very little information, and the documentation only a bit more (pun intended!)

Can we combine them? The title has SymbolKind which normally holds the category. We can't easily add new SymbolKinds (it's an enum we don't own, which we should fix, but that's a yak-shave). But `TypeAlias` almost fits these roles for auto. What do you think about setting Kind/Name/Definition? This would give:

  type-alias `auto`
  const Foo&

This leaves the question of what to do with undeduced auto, maybe:

  type-alias `auto`
  /* not deduced */

(There are other cases: function parameter types `void foo(auto X)` and NTTP types `template <auto X> class Y` but we can punt on those)

this
----

D92041 <https://reviews.llvm.org/D92041> recently added support for showing the type when hovering over `this`. It followed the existing `auto` behavior (put everything in `Name`) because that's the only place we were showing types per se.

So you're going to have a merge conflict, and we need to decide how to render it.

I don't really have a better idea than setting `Name = "this"`, setting `Definition`, and leaving Kind=Unknown. Maybe we can do better once we can easily extend the SymbolKind enum.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93227/new/

https://reviews.llvm.org/D93227



More information about the cfe-commits mailing list