Skip to content

Inlay hints acquire font styling from the character that follows them #6380

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

Closed
dfoxfranke opened this issue Oct 27, 2020 · 6 comments · Fixed by #6392
Closed

Inlay hints acquire font styling from the character that follows them #6380

dfoxfranke opened this issue Oct 27, 2020 · 6 comments · Fixed by #6392

Comments

@dfoxfranke
Copy link
Contributor

I have VSCode theme that puts operators in bold. A closure in my code written as |chunk| has an inferred argument type of Result<Bytes, Error>, rendered in my editor as an inlay hint. Correct behavior would be to render the |'s in bold but not anything in between them. Instead, I get a (correctly) regularly-styled chunk but a bold : Result<Bytes, Error>| following it.

The type renders correctly (i.e. not in bold) if I write it out explicitly rather than having it filled in as an inlay hint. So this seems to be an issue particular to inlays, and not a problem with any of the patterns in rust.tmGrammar.json.

@bjorn3
Copy link
Member

bjorn3 commented Oct 27, 2020

This is a limitation of the lsp/vscode Inlay hints can only be attaches before or after a character, not in between two characters.

@lnicola
Copy link
Member

lnicola commented Oct 27, 2020

@dfoxfranke does #6382 do anything for you?

@dfoxfranke
Copy link
Contributor Author

@lnicola Confirmed, this fixes it for me. You probably also want textDecoration: "none", to remove underlines.

@kjeremy
Copy link
Contributor

kjeremy commented Oct 28, 2020

@dfoxfranke what theme are you using? I'd like to be able to reproduce this to make sure that #6394 didn't regress. Alternatively you can update to latest master and test it out.

@dfoxfranke
Copy link
Contributor Author

dfoxfranke commented Oct 28, 2020

@kjeremy It's a theme I'm developing and it's not released yet, but it will be soon, probably this weekend; after then look for "Lunaria" on the extension marketplace. By the looks of the diff, it won't regress on my theme (which puts operators in bold) but will regress on any theme that underlines operators (I don't know of any that do this).

Regardless, I have to say I really dislike this change. I designed the theme I'm working on specifically with rust-analyzer inlay hints in mind, and it arranges colors in such a way that the inlay hints are already readable and clearly distinct from the surrounding text. Varying the font size will make them less legible and distracting, and if you're going to do this I wish you'd provide a toggle for it.

@kjeremy
Copy link
Contributor

kjeremy commented Oct 28, 2020 via email

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

Successfully merging a pull request may close this issue.

4 participants