This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Omit type hints that are too long
ClosedPublic

Authored by nridge on Aug 31 2021, 12:56 AM.

Diff Detail

Event Timeline

nridge created this revision.Aug 31 2021, 12:56 AM
nridge requested review of this revision.Aug 31 2021, 12:56 AM
nridge added inline comments.Aug 31 2021, 12:57 AM
clang-tools-extra/clangd/InlayHints.cpp
346

I'm open to suggestions for what the length limit should be, here I made a fairly arbitrary choice.

kadircet accepted this revision.Sep 3 2021, 3:27 AM
kadircet added a subscriber: sammccall.

Thanks! I was having some discussions with @sammccall about what we really want here. We think folding the arguments & dropping qualifiers until hint fits under the limit would be the most ideal but there's no rush. A stepping stone would be to just truncate all the template arguments (e.g. tuple<foo<x>, foo<y>> becomes tuple<...> even if tuple<foo<...>, foo<...>> could fit under the limit). Omitting is also fine initially, even though it's gonna feel weird (as if clangd couldn't find any hints) it is still better than extending the line to infinity!

This revision is now accepted and ready to land.Sep 3 2021, 3:27 AM

A stepping stone would be to just truncate all the template arguments (e.g. tuple<foo<x>, foo<y>> becomes tuple<...> even if tuple<foo<...>, foo<...>> could fit under the limit).

I was thinking the same thing :) I will write a patch to do this as a follow-up.

This revision was automatically updated to reflect the committed changes.