Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

rust-analyzer: Add better support for TypeHints and ParameterHints #14

Closed
PatOConnor43 opened this issue Oct 25, 2020 · 8 comments
Closed

Comments

@PatOConnor43
Copy link
Contributor

The current rust inlay-hints implementation puts everything at the end of the line when the intended behavior of Type and Parameter hints is to be interspersed in the line. We should be able to draw these hints more closely to this.
image
Where TypeHints go after variable declarations and ParameterHints are paired with their variables.

Related PRs:
#13
#9

@mvforell
Copy link

To my knowledge it is currently not possible to display the hints in other positions than at the end of the line. The hints are added as virtual text which can only be placed after any other text in the line (see the documentation).

@PatOConnor43
Copy link
Contributor Author

I just read that in the docs too 😅 Well, this may not work how I want it to then 😬

@mvforell
Copy link

I guess we'll have to wait until NeoVim supports virtual text in arbitrary positions...

@PatOConnor43
Copy link
Contributor Author

This PR seems very related as well neovim/neovim#9496

@PatOConnor43
Copy link
Contributor Author

It also seems like coc-rust-analyzer also only supports ChainingHints for this reason.
fannheyward/coc-rust-analyzer#177 (comment)

@rockerBOO
Copy link
Collaborator

#19

This adds support for setting your own options of the hints you want.

require'lsp_extensions'.inlay_hints{ enabled = {"ChainingHint", "TypeHint", "ParameterHint"} } 

@PatOConnor43
Copy link
Contributor Author

That should be fine. I'll close this.

@univerz
Copy link

univerz commented Feb 3, 2021

this workaround looks useful fannheyward/coc-rust-analyzer#394 (comment)

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

No branches or pull requests

4 participants