[clang-tools-extra] [clangd] Improve `BlockEnd` inlayhint presentation (PR #136106)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 20 23:04:45 PDT 2025
================
@@ -2305,7 +2335,45 @@ TEST(BlockEndHints, PointerToMemberFunction) {
$ptrmem[[}]]
} // suppress
)cpp",
- ExpectedHint{" // if", "ptrmem"});
+ ExpectedHint{" // if ()", "ptrmem"});
+}
+
+TEST(BlockEndHints, MinLineLimit) {
+ assertBlockEndHintsWithOpts(
+ R"cpp(
+ namespace ns {
+ int Var;
+ int func1();
+ int func2(int, int);
+ struct S {
+ int Field;
+ int method1() const;
+ int method2(int, int) const;
+ $struct[[}]];
+ $namespace[[}]]
+ void foo() {
+ int int_a {};
+ while (ns::Var) {
+ $var[[}]]
+
+ while (ns::func1()) {
+ $func1[[}]]
+
+ while (ns::func2(int_a, int_a)) {
+ $func2[[}]]
+
+ while (ns::S{}.Field) {
+ $field[[}]]
+
+ while (ns::S{}.method1()) {
+ $method1[[}]]
+
+ while (ns::S{}.method2(int_a, int_a)) {
+ $method2[[}]]
+ $foo[[}]]
+ )cpp",
+ InlayHintOptions{10}, ExpectedHint{" // namespace ns", "namespace"},
----------------
HighCommander4 wrote:
I'd rather we be a bit more explicit:
```c++
InlayhintOptions Opts;
Opts.HintMinLineLimit = 10;
...
assertBlockEndHintsWithOpts(..., Opts, ...);
```
as there may be more options in the future and it's not obvious which is first.
https://github.com/llvm/llvm-project/pull/136106
More information about the cfe-commits
mailing list