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

Tom Praschan via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 11 14:13:58 PDT 2024


================
@@ -3941,6 +3945,157 @@ TEST(Hover, DisableShowAKA) {
   EXPECT_EQ(H->Type, HoverInfo::PrintedType("m_int"));
 }
 
+TEST(Hover, ShowFields) {
+  struct {
+    const char *const Code;
+    const std::function<void(HoverInfo &)> ExpectedBuilder;
+  } Cases[] = {
+    {
+      R"cpp(// Struct
+        namespace ns1 {
+          struct MyClass {
+            // Public fields shown in hover
+            int field1;
+            int field2;
+
+            // Methods and private fields not shown
+            void method();
----------------
tom-anders wrote:

would it make sense to add an additional option that also shows public methods? (probably out-of-scope for this PR though)

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


More information about the cfe-commits mailing list