vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Option to hide inlay hints only for single-parameter functions

Open LMauricius opened this issue 6 months ago • 3 comments

Feature Request

While being sure you're using the correct overload is nice, for most single-parameter functions inlay hints just take space. When nesting a lot of conversion or simple math functions these can increase line length quite substantially, even with really small fonts.

For some projects showing inlay hints only for multi-parameter functions would be a good compromise. Could this option be added?

LMauricius avatar Jun 01 '25 08:06 LMauricius

@LMauricius It's theoretically possible. However, I'm not aware of any other inlay hint implementation which has such an option. Inlay hints aren't just useful for seeing which overload you're using, and a single parameter function could still have multiple overloads based on the single parameter's type.

sean-mcmanus avatar Jun 02 '25 16:06 sean-mcmanus

Of course, but it's not a good guarantee that you're using the correct overload either since multiple overloads can have the same parameter name. For single parameter functions you mostly don't need the parameter name, since you don't have the several parameters to disambiguate from.

It's a wild guess, but I assume one of the reasons why inlay hints aren't widely used is that they clutter the editor with unnecessary hints. For multi-parameter functions they are useful for readability since you don't need to click on the function to show the documentation, but for more mathematical mappings they just stand in the way.

If I were to make a merge request with such a functionality where would I start?

LMauricius avatar Jun 02 '25 21:06 LMauricius

@LMauricius The source of the inlay hints is from the closed source cpptools component (which does the C++ type parsing), but the open source TypeScript has the settings and does processing of the inlay hints before sending them to VS Code, so it might be possible to implement the filtering in the TypeScript if it doesn't require any complicated C++ parsing (I haven't confirmed that). The bulk of the open source implementation is at Extension\src\LanguageServer\Providers\inlayHintProvider.ts .

You might also consider using the "editor.inlayHints.enabled": "offUnlessPressed", which only shows the inlay hints when a key combo is pressed.

sean-mcmanus avatar Jun 02 '25 21:06 sean-mcmanus

This feature request is being closed due to insufficient upvotes. Please leave a 👍-upvote or 👎-downvote reaction on the issue to help us prioritize it. When enough upvotes are received, this issue will be eligible for our backlog.

github-actions[bot] avatar Aug 02 '25 11:08 github-actions[bot]