kitamstudios / rust-analyzer.vs

Rust language support for Visual Studio 2022
https://marketplace.visualstudio.com/items?itemName=kitamstudios.RustAnalyzer
Other
138 stars 10 forks source link

How to turn on inlay hints? #35

Open jestarray opened 11 months ago

jestarray commented 11 months ago

inlay hint

as you can see, the calls to test in main() show light text of the function parameter names in vscode. I don't know how to get this working with visual studio but it's built into rust analyzer. I think C/C++ has this feature too

parthopdas commented 11 months ago

okay inlay hints are present for both C++ and C#. Need to press Alt+F1. Ref https://stackoverflow.com/questions/71788959/visual-studio-community-2022-inline-hints-shortcut

jestarray commented 11 months ago

Yeah, I recall this not working with rust in vstudio but will need to double check

parthopdas commented 11 months ago

okay investigate this.

  1. inlay hints are supported by LSP https://github.com/microsoft/vscode/issues/113276
  2. it is possible for LSP clients packages in VS2022 to invoke the LSP in addition to the usual comms between VS2022 and LSP like rust-analyzer see https://learn.microsoft.com/en-us/visualstudio/extensibility/adding-an-lsp-extension?view=vs-2022#send-custom-messages
  3. 2 is implemented in r-a.vs in LanguageClient.cs

the fix would be to do the same thing C# does - on Alt+F1, r-a.vs invokes the LSP using step 3, get back the inlay hints and display it using editor adornments.

it is also is a good idea to add this plumbing for further enhancements that VS2022 does not provide out of the box but LSPs do. e.g. unit test run / debug code lenses.

the fix would take a couple of days. i would welcome contribution from the community.

alternatively i can get to when when i have some free time.

tausifcreates commented 8 months ago

any updates on this?

parthopdas commented 8 months ago

None unfortunately. January is the earliest I'll have free time and it should be implemented then.

rasimv commented 1 month ago

How to disable inlay hints? rustanq