[clangd] Smarter hover on auto and decltype
authorQuentin Chateau <quentin.chateau@gmail.com>
Fri, 18 Dec 2020 15:10:29 +0000 (16:10 +0100)
committerSam McCall <sam.mccall@gmail.com>
Fri, 18 Dec 2020 15:27:09 +0000 (16:27 +0100)
commitc46c7c9bcf9752971fe4bbcf67140c99066ad2e0
tree3ba5f06e869d564bc8f286c842bc52a745ec2458
parent47aaa99c0e1e28573bf24d95c5540005ee734531
[clangd] Smarter hover on auto and decltype

Only show the keyword as the hover "Name".

Show whether the type is deduced or undeduced as
the hover "Documentation".

Show the deduced type (if any) as the "Definition".

Don't show any hover information for:
- the "auto" word of "decltype(auto)"
- "auto" in lambda parameters
- "auto" in template arguments

---------------

This diff is a suggestion based on what @sammccall  suggested in https://reviews.llvm.org/D92977 about hover on "auto". It somehow "hacks" onto the "Documentation" and "Definition" fields of `HoverInfo`. It sure looks good on VSCode, let me know if this seem acceptable to you.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D93227
clang-tools-extra/clangd/AST.cpp
clang-tools-extra/clangd/AST.h
clang-tools-extra/clangd/Hover.cpp
clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
clang-tools-extra/clangd/unittests/HoverTests.cpp