-
Notifications
You must be signed in to change notification settings - Fork 165
Can VS Code support CLion-like type-hint? #374
Comments
Woah, how did you do that? |
My actual goal was to do parameter hints like IntelliJ (which can be done heuristically e.g. only when there are >3 params or when multiple parameters have the same type). I could not find a way to get that information out of the compiler / from rls-analysis (would maybe need to walk the AST to find all function call tokens?). The protocol does not support this by default, there is an open issue for VScode here: microsoft/vscode#16221, so I used a custom notification sent from DocumentSymbols which has the most relevant information and is called on every document change for me. See these two patches: rls-vscode, rls. |
@phiresky Nice!
Why does it need to be a blocking request? We usually only use these for lifecycle requests. I don't think the notifcation needs to be sent async - we're not waiting for a reply or anything, so sending a reply is fast. |
The only reason I changed it to a BlockingRequestAction is because I couldn't find a way to get a reference to the I didn't really mean async.. just meant without making the Symbols RequestAction a BlockingRequestAction. I'm not a Rust expert as you might have noticed :) I'm also not sure if this is even the right place to put that (and who actually calls DocumentSymbols and why) |
I think the right approach is to include that data in the response rather than sending a separate notification. Not sure if there are fields you can use already to do that, but if not, you can always add custom fields to the protocol messages. |
What is the status on this? |
@Kreyren It seems done. |
@DCjanus can't confirm on my end, is there any specific configuration for this? |
oh, I just made a silly mistake, I'm using rust-analyzer and I thout we are talking about it. (I subscribed this issue long time ago, when notification came, I thout it's from rust-analyzer) |
@DCjanus Can rust-analyzer do this? |
I wrote a PR (#587) for this a while ago. It's not perfect, so I understand why they wouldn't want to merge it, but you can always use my fork if you want. I don't really update it much though, so you may want to keep your own fork if you want. But yes, |
CLion can display a "span" prompting the auto deduced type/argument name/etc. I wonder if this is possible in VS Code too? (Doesn't have to be exactly the same.)
The text was updated successfully, but these errors were encountered: