-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Implement textDocument/typeDefinition #201
Comments
We also need to handle type parameters properly (I.e. typeDefinition should jump to the function signature/ |
@kjeremy note that "get type of the epxression" is actually required for signature info as well. For something like
You need to figure out that |
We now have Let's expose it on the LSP layer. To do this, one needs to add a handler function here: and register it over here: |
I'll try it. |
type_of function needs FileRange, but TextDocumentPositionParams does not have range. If there is not, I'd like to add that function. |
Oh, wait, Looks like there's no built-in support for Params would be a text document id and a range, response would be a string Then one should add & register handler as described above. Then, for VS Code, in typescript, one should define a new register it here: and write the actual implementation here The implemntation should work like the one for extend selection, and use VS Code API to show a message with type to the user. |
In Typescript, the type is shown on hover. Should we try and emulate that too/instead. |
Good point! I think we should have both: hover doesn't allow selecting the expression, and it is useless for folks who don't use mouse :) |
I see that.
I also think geting the type of expression might be implemented as hover for now. |
LanguageClient-neovim handles |
BTW, implementing showing type definition whether |
You can get the expression under the cursor using the For I think we should show types of local variables on hover, but it would also be nice to have a way to get the type of an arbitrary expression (e.g. in (By the way, Emacs' |
BTW, I think |
I think that the Ty type should have a way to get the types SourceFileItemId, so we can just use that. That will go to the struct def or union def etc. |
@matklad Sorry for everyone to take some time to understand that. |
I am going to close this issue and split it into the two, because I am myself confused as to what exactly we are discussing :-)
|
@h-michael I've split off #389 and #388. I think we should do #389 first, I've added some more concrete instructions for that. If anything is unclear, do ask questions at that issue! |
From #197
@aochagavia :
On the LSP front this would involve implementing
textDocument/typeDefinition
.The text was updated successfully, but these errors were encountered: