Skip to content

Add locate-type-multi command #148

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add locate-type-multi command #148

wants to merge 1 commit into from

Conversation

liam923
Copy link
Contributor

@liam923 liam923 commented Jun 12, 2025

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 on Tconstrs, and when the Tconstr carries arguments, it just ignores the args. In other words, the command doesn't provide the ability to go to a'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 is a -> (b * c), it returns the locations of all of a, b, and c, and this is in a tree-like data structure that makes it easy for VSCode to present this to the user.

@liam923 liam923 requested a review from goldfirere June 12, 2025 06:26
@liam923 liam923 force-pushed the locate-type-multi branch from 0375df3 to e46b24b Compare June 12, 2025 06:34
@liam923 liam923 force-pushed the locate-type-multi branch from e46b24b to 17cd8de Compare July 22, 2025 20:08
@liam923
Copy link
Contributor Author

liam923 commented Jul 22, 2025

I've made a corresponding PR upstream: ocaml/merlin#1951

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant