[PATCH] D72500: [clangd] Show hower info for expressions

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 13 06:07:21 PST 2020


kadircet added a comment.

In D72500#1813975 <https://reviews.llvm.org/D72500#1813975>, @sammccall wrote:

> Basing this on the hover for the type doesn't seem right. e.g. `int` should be the `Type` rather than the `Name`.
>
> Rather than printing the value if evaluable, I think we should only show the hover if evaluable. There's a cost to showing it and the value of just the type doesn't seem clearly high enough.
>
> I think we should avoid triggering for literals. Maybe some exceptions, but a hover saying that 0 is an int with value 0 seems silly.


agreed.

In D72500#1815780 <https://reviews.llvm.org/D72500#1815780>, @lh123 wrote:

> In D72500#1813975 <https://reviews.llvm.org/D72500#1813975>, @sammccall wrote:
>
> > I think we should avoid triggering for literals. Maybe some exceptions, but a hover saying that 0 is an int with value 0 seems silly.
>
>
> Hovering over `IntegerLiteral/FloatingLiteral` may be useless, but I think it's useful when hovering over `StringLiteral/UserDefinedLiteral/CXXNullPtrLiteralExpr ...`.
>
> - `"hello"` -> `char [6]`.
> - `nullptr` -> `std::nullptr_t`.
> - `1i` -> `std::complex<double>`.


I believe all but the first case seems redundant. So I am only keeping the StringLiterals and dropping the rest.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72500





More information about the cfe-commits mailing list