hokein added inline comments.

================
Comment at: clang-tools-extra/clangd/Config.h:151
+    // Limit the length of type names in inlay hints.
+    size_t TypeNameLimit = 32;
   } InlayHints;
----------------
zhangyi1357 wrote:
> hokein wrote:
> > I would extend it a bit more -- 0 means no limit. 
> > 
> > Can you also add a unittest in `TEST(TypeHints, LongTypeName)` in 
> > `InlayHintTests.cpp`? 
> > 0 means no limit.
> This is quite a good idea. I've done it.
> 
> For unittest, there is already `TEST(TypeHints, LongTypeName)` in 
> `InlayHintTests.cpp`. Do you mean add more tests in the same `TEST` or 
> another `TEST` with TypeNameLimit configured?
> 
I mean adding one more test in the same `TEST(TypeHints, LongTypeName)`.

This test verifies the the long type name is shown when the limit is set to 0, 
something like

```
TEST(TypeHints, LongTypeName) {
  assertTypeHints(R"cpp(
    template <typename, typename, typename>
    struct A {};
    struct MultipleWords {};
    A<MultipleWords, MultipleWords, MultipleWords> foo();
    // Omit type hint past a certain length (currently 32)
    auto var = foo();
  )cpp");

    Config cfg; 
     ... // set the limit to 0

   assertTypeHints(R"cpp(
    template <typename, typename, typename>
    struct A {};
    struct MultipleWords {};
    A<MultipleWords, MultipleWords, MultipleWords> foo();
    // Omit type hint past a certain length (currently 32)
    auto var = foo();
  )cpp", ExpectedHint...);
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147395

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

Reply via email to