-
Notifications
You must be signed in to change notification settings - Fork 51
Inlay hint support #71
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
Conversation
Signed-off-by: Adam Tao <tcx4c70@gmail.com>
Add type inlay hint to the end of identifiers, just like what clangd does. This commit is almost a rewrite of https://github.com/dotnet/roslyn/blob/main/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs. Because Roslyn doesn't exposes the related classes/methods (they are `internal`), we can't call them directly. Therefore, I try to rewrite them using F# in this commit. Signed-off-by: Adam Tao <tcx4c70@gmail.com>
Signed-off-by: Adam Tao <tcx4c70@gmail.com>
Add parameter inlay hints before afguments, just like what clangd does. This commit is almost a rewrite of https://github.com/dotnet/roslyn/blob/main/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs. Signed-off-by: Adam Tao <tcx4c70@gmail.com>
Signed-off-by: Adam Tao <tcx4c70@gmail.com>
1. Suppress parameter hint for indexer. 2. Suppress parameter hint if argument matches parameter name. Signed-off-by: Adam Tao <tcx4c70@gmail.com>
I was dabbling into this some months ago and had the same observation. But you did reimplement it properly, 🙇🏻 |
|
Will do some testing and will merge. Thank you! |
|
Works with vscode nicely! Thanks! (I was using https://github.com/statiolake/vscode-csharp-ls to test this, because emacs/lsp-mode does not apparently support inlay hints yet) |
|
I do see a little issue (see screenshot below). The |
@razzmatazz Will investigate it and will try to fix. Thanks for your testing! |


This PR is trying to add support for inlay hint. In fact, Roslyn has
already implemented the feature via language service in
https://github.com/dotnet/roslyn/blob/main/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs &
https://github.com/dotnet/roslyn/blob/main/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs.
However, the implementation and the interface,
IInlineHintsService,are
internal, so we can't call the implementation directly (we can'teven get the implementation via
doc.Project.LanguageServices.GetRequiredService<IInlineHintsService>).Hence, this PR rewrites the implementation using F#. Unlike the
implementation in Roslyn, however, this PR always puts type inlay hints
after the identifier and parameter inlay hints before the argument, just
like what clangd does, because not only will it keep the implementation
simple, but also it's the position I like.