[clangd] Make our printing policies for Hover more consistent, especially tags
authorSam McCall <sam.mccall@gmail.com>
Fri, 18 Dec 2020 17:39:20 +0000 (18:39 +0100)
committerSam McCall <sam.mccall@gmail.com>
Fri, 18 Dec 2020 23:52:55 +0000 (00:52 +0100)
commitb0615642f647bea1483659f1e14515a836015254
tree8525a69b4d3a94debe753f70e455ed9c26198c76
parentadc55b5a5ae49f1fe3a04f7f79b1c08f508b4307
[clangd] Make our printing policies for Hover more consistent, especially tags

Different cases were using a bunch of different variants of the printing policy.
Each of these had something going for it, but the result was inconsistent.

Goals:
  - single printing policy used (almost) everywhere
  - avoid unidiomatic tags like `class vector<class X>`
  - be informative and easy to understand

For tags, the solution I wound up with is: we print only the outer tag and only
in the simplest cases where this elaboration won't cause confusion.

For example:
 - class X
 - enum Foo
 - vector<int>
 - X*

This seems to strike a nice balance of providing plenty of info/context in common
cases while never being confusing.

Differential Revision: https://reviews.llvm.org/D93553
clang-tools-extra/clangd/Hover.cpp
clang-tools-extra/clangd/unittests/HoverTests.cpp