Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to limit BlockEnd hints to tall blocks #1807

Open
HighCommander4 opened this issue Oct 29, 2023 · 6 comments
Open

Add an option to limit BlockEnd hints to tall blocks #1807

HighCommander4 opened this issue Oct 29, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@HighCommander4
Copy link

I've been using clangd 17 with the new BlockEnd inlay hints added in #1634, and I'm finding that the hints are quite useful for tall blocks (say, more than 10 lines) where the beginning of the block is more likely to be offscreen, but just add visual noise for shorter blocks where the beginning of the block is more likely to be on-screen.

It might be nice to add a config option to set the minimum number of lines a block should be to get the hint.

@daiyousei-qz what do you think?

@HighCommander4 HighCommander4 added the enhancement New feature or request label Oct 29, 2023
@daiyousei-qz
Copy link

I believe we had one in the original patch, but it was removed as requested in the code review. We decided to try to configure a good default in clangd. @sam-mccall for comment.

@HighCommander4
Copy link
Author

We decided to try to configure a good default in clangd.

I'm seeing the hints even after blocks with a 1-line body.

@HighCommander4
Copy link
Author

It looks like the limit currently in the code is 2, and the block height is considered to include the lines with the braces, so the only blocks that are excluded are the ones where the braces are on the same line.

I think I'd want to set the minimum to something in the 6-10 line range. I suppose I'd be fine with a hard-coded limit in that range, but I also feel like this is an area where different developers may have different preferences.

@daiyousei-qz
Copy link

Yeah, this depends on the font size and how tall people's screen gets. Though I think the number should be large enough so it's not getting too dense in noise yet not too large so the threshold exceeds the number of lines the screen could display. In this case, 6-10 sounds good to me.

@daiyousei-qz
Copy link

@HighCommander4 Do you want to me handle this issue? We have to determine either we want to add a config or update the minimum line requirement.

I started using clangd17 lately and noticed the verboseness is amplified by new hints added at end of statement blocks.

@HighCommander4
Copy link
Author

@HighCommander4 Do you want to me handle this issue? We have to determine either we want to add a config or update the minimum line requirement.

I started using clangd17 lately and noticed the verboseness is amplified by new hints added at end of statement blocks.

Sure, please go ahead.

I think just changing the hard-coded limit for now should be fine. If we get users asking for the hints on shorter blocks, we can consider a config option at that time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants