Add locate-type-multi
command
#148
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new command,
locate-type-multi
, that enables new VSCode functionality.A useful current command in VSCode is "Go to Type Definition", which uses the
locate-type
query to go to the definition of the type of the identifier under the cursor. However, this command is rather limited - it only works onTconstr
s, and when theTconstr
carries arguments, it just ignores the args. In other words, the command doesn't provide the ability to go toa
's defintion if the type is any of the following:a t
,(a * _)
,a -> _
,_ -> a
.locate-type-multi
, instead of always just returning the location of a single identifier, returns a tree structure that represents all the identifiers within a type. So for example, if the type isa -> (b * c)
, it returns the locations of all ofa
,b
, andc
, and this is in a tree-like data structure that makes it easy for VSCode to present this to the user.