Skip to content

Limit length for type inlays #4151

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

Open
pca006132 opened this issue Apr 26, 2020 · 4 comments
Open

Limit length for type inlays #4151

pca006132 opened this issue Apr 26, 2020 · 4 comments
Labels
A-inlay-hints inlay/inline hints S-actionable Someone could pick this issue up and work on it right now

Comments

@pca006132
Copy link

Some embedded device crates use generated codes and the type can get very long, such as the stm32f1xx_hal::stm32::Peripherals struct.

In VSCode, the type inlay would become something like this when you type:

Screenshot from 2020-04-26 14-26-39

It would be better to add an option to limit the length of the type inlays, and display the remaining portion as ....

@bjorn3
Copy link
Member

bjorn3 commented Apr 26, 2020

This was already implemented in #1980.

@pca006132
Copy link
Author

This was already implemented in #1980.

I've checked the current code, it seems that the functionality is still there but the truncation is moved to the language server part instead of the vscode extension part.

The default maximum length is 20 characters, but obviously in the example above it exceeded 20 characters already. So I think this should be considered a bug?

@ruabmbua
Copy link
Contributor

I use the exact same type in one of my projects, the inlay hint is short. Why does it add the member types in () brackets in your case? I thought it would only add actual type parameters.

screenshot_2020-10-17_14-49-20_444143413

@flodiebold
Copy link
Member

It's showing the type of the constructor Peripherals(... lots of parameters...) -> Peripherals, like if it was a tuple struct. If you write Peripherals in a value context, we don't check whether it's actually a tuple struct.

@lnicola lnicola added the S-actionable Someone could pick this issue up and work on it right now label Jan 22, 2021
@Veykril Veykril added the A-inlay-hints inlay/inline hints label May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inlay-hints inlay/inline hints S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

6 participants