rust-analyzer.vs icon indicating copy to clipboard operation
rust-analyzer.vs copied to clipboard

How to turn on inlay hints?

Open jestarray opened this issue 2 years ago • 6 comments

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

jestarray avatar Aug 22 '23 14:08 jestarray

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

parthopdas avatar Aug 24 '23 02:08 parthopdas

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

jestarray avatar Aug 24 '23 02:08 jestarray

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.

parthopdas avatar Aug 24 '23 02:08 parthopdas

any updates on this?

tausifcreates avatar Nov 22 '23 17:11 tausifcreates

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

parthopdas avatar Nov 22 '23 22:11 parthopdas

How to disable inlay hints? rustanq

rasimv avatar May 31 '24 07:05 rasimv