sammccall added a comment.

We **have** been thinking about problems with inlay hints being verbose, and 
array initializers that are visible by default are clearly seen as spammy.
Thanks for sending a patch. I filed 
https://github.com/clangd/clangd/issues/1277 about this just now and added some 
thoughts.
FWIW when *not* shown by default (VSCode's offUnlessPressed) these don't seem 
to be spammy.

Adding a new option is always easy, but actually helps relatively few people 
unless we change the default.
So I think we should change the default behavior, and **consider** making it 
configurable if we get requests to add it back.

(I have reservations about the details of the config schema in this patch, but 
we can improve it if needed).



================
Comment at: clang-tools-extra/clangd/InlayHints.cpp:77
+      }
+      return false;
     }
----------------
This means that both array-nested-in-struct and struct-nested-in-array will 
produce no hints at all.
This is probably a rare case, but IMO one that will likely benefit from 
designators.

The smallest behavior change to address the common case would be to drop 
designators that only contain a single array index.

I suppose the neatest way to achieve this is to bail out at (old) line 153:

```
if (Fields.isArray() && !BraceElidedSubobject && Prefix.empty())
  // Here we'd emit only a trivial array designator.
  // This isn't useful: https://github.com/clangd/clangd/issues/1277
  continue;
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131066

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to