[clang] [clang-tools-extra] [clangd] Show struct fields and enum members in hovers (PR #89557)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 21 22:24:31 PDT 2024


HighCommander4 wrote:

A few things I would appreciate feedback on:

 1. I know a [previous comment on the bug](https://github.com/clangd/clangd/issues/959#issuecomment-998927030) stated "We don't show bodies of classes/enums/functions etc by policy", but can we consider changing this policy in the more limited case of public struct fields and enum members? Like I mentioned in [this comment](https://github.com/clangd/clangd/issues/959#issuecomment-2068307365), the usefulness/verbosity tradeoff might be different in this subset of cases. Also cc @colin-grant-work in case you'd like to weigh in on this further.
 2. If we're willing to make this change, do we want it unconditionally, or behind a new config option in the `Hover` section? My personal opinion is that even in the case of a struct/enum with many members this is not particularly bothersome and would lean towards making it unconditional, but I am of course happy to put it behind a config option if that helps build a consensus for this.
 3. Regarding the implementation approach, is it fine to add a flag to `PrintingPolicy` (which is a clang utility class used in a variety of places) for a clangd-specific use case like this? I did it this way because the alternative seemed to involve duplicating a bunch of code related to decl-printing, but I'm happy to explore alternatives if this is an issue.

https://github.com/llvm/llvm-project/pull/89557


More information about the cfe-commits mailing list