Skip to content

Inlay hints highlighted #11733

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
YounessBird opened this issue Mar 16, 2022 · 15 comments
Closed

Inlay hints highlighted #11733

YounessBird opened this issue Mar 16, 2022 · 15 comments

Comments

@YounessBird
Copy link

First of all, massive thanks for creating this tool.
I have been using rust analyzer's "Inlay hints" for quite a while and I noticed yesterday that this feature is now somehow highlighted in my code. I thought maybe it was an automatic update, so I tried previous version of rust analyser but I still could see the highlight, I have also tried the options in the settings, and that didn't work either.

I am using VsCode, version: 1.65.2.
here is a screenshot of what the highlight looks like
rust-analyzer

Please let me know if there are any more information required.

@lnicola
Copy link
Member

lnicola commented Mar 16, 2022

This is the styling of the native inlay hints (released this week, see https://rust-analyzer.github.io/thisweek/2022/03/14/changelog-120.html). They can be configured, though.

But never mind the styling, what happened with the function argument there?

@bayedieng
Copy link

How to revert to making the inlay transparent like it used to?

@YounessBird
Copy link
Author

YounessBird commented Mar 16, 2022

@lnicola

what happened with the function argument there?

I have only noticed that after I took the screenshot, I also couldn't reproduce whatever glitch that was. Maybe it's worth noting though, that at least in my case I have noticed that the inlay hints take longer now to render in my VsCode for whatever reason.
I also couldn't find an option to disable the inlay hints background colour, maybe because of this merged pull request it says there that:

"rust_analyzer.inlayHints.foreground.typeHints": "#fdb6fdf0",
 "rust_analyzer.inlayHints.foreground.paramHints": "#fdb6fdf0",
 "rust_analyzer.inlayHints.background.chainingHints": "#6b0c0c81"

are now customized using native VSCode settings instead of rust-analyzer-specific ones and that possibly there is no equivalent for the chainingHints color available in VScode settings yet.
I have looked in the VSCode setting as well but to no avail.
I have also tried different themes to see what the background color will look like and in some themes it doesn't look good at all, I can post a screenshot as an example if required.
if there is a way to disable this new feature please provide guidance.

@jhgg
Copy link
Contributor

jhgg commented Mar 16, 2022

FYI - I opened an issue about making the inlay hints look more like the old-style inlay hints via a config in vs-code here: microsoft/vscode#145191

Discussion is ongoing!

@lnicola
Copy link
Member

lnicola commented Mar 17, 2022

See also the docs: https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/manual.adoc#color-configurations (the rendered version of the PR you've linked to).

the inlay hints take longer now to render in my VsCode for whatever reason

They're slower while typing because Code intentionally delays updating them.

@lnicola
Copy link
Member

lnicola commented Mar 17, 2022

Let's close this, since there's nothing we can do about the formatting (except coordinating with Code, like jhgg did). If you run into glitchy hints again, please check the Rust Analyzer Language Server output channel for any errors and file a new issue.

@lnicola lnicola closed this as completed Mar 17, 2022
@YounessBird
Copy link
Author

@lnicola Thanks for the link, maybe it's worth noting that those changes are not reflected in the rust-analyser website specifically in the link provided under configuration in the extension's home page. I will be happy to contribute if you can provide me guidance.

@lnicola
Copy link
Member

lnicola commented Mar 17, 2022

The published manual is updated automatically on Monday after the release. So there's no need to do anything about it.

@Fenex
Copy link

Fenex commented Mar 17, 2022

New style of infered types is SO MUCH YELLING... For now I can't read my value code with default style settings anymore :(

изображение

@lnicola
Copy link
Member

lnicola commented Mar 17, 2022

@Fenex what if you set the hint background to black or transparent?

@YounessBird
Copy link
Author

YounessBird commented Mar 17, 2022

@Fenex using this settings made it look almost like how it used to be except for the padding
add to your settings.json

"workbench.colorCustomizations": {
    "editor.inlayHints.fontFamily": "Courier New",
    "editor.inlayHints.fontSize": 11,
    "[Your-theme-name]": {
      "editorInlayHint.foreground": "#868686f0",
      "editorInlayHint.background": "#ff000000",
      "editorInlayHint.typeForeground": "#aaa5aaf0",
      "editorInlayHint.parameterForeground": "#fdb6fdf0"
    }

don't forget to substitute Your-theme-name

@Fenex
Copy link

Fenex commented Mar 17, 2022

@lnicola @YounessBird thanks very much for your help. Your listing is really help me and now I'm happy again!

Howver. By the way.

I don't think that this change was really indeed.

An infered types are not importantly in a code, it's just an optional notes (notes that can make more clear of small piece of the code). A code must explains general sense of alghorithm and infered types is secondary stuffs. I'm sure any secondary stuff must be smaller, opacitier and non-yellier by default. I want pay your attention to my above screenshot: there is a default theme and result view is very-very awful (my opinion). I guess this will afraid new little rustaceans (hope i wrong) :(

@lnicola
Copy link
Member

lnicola commented Mar 17, 2022

@Fenex this change replaced a hacky implementation of inlay hints (using CSS :after pseudo-elements via Code decorations) with the native one, which is better when using word wrapping, screen readers and probably other things. And we have no wish to maintain the previous implementation, so it was needed.

About the styling itself, that's the decision of the Code maintainers. The background was added because the hints themselves looked very similar to the inline completion suggestions. Fortunately, it's relatively customizable, and it will probably get better in time.

@Fenex
Copy link

Fenex commented Mar 17, 2022

Wow. Thanks for exhaustive explanation! My fail I thought this was only visual change. Now it's clear. Thank you for support!

@jhgg
Copy link
Contributor

jhgg commented Mar 18, 2022

They're slower while typing because Code intentionally delays updating them.

microsoft/vscode#145377

I've opened a feature request on vscode's end to allow the delay to be user configurable!

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

No branches or pull requests

5 participants