Skip to content
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

Handle merlin typed holes #1698

Merged
merged 1 commit into from
Jul 19, 2021
Merged

Conversation

gpetiot
Copy link
Collaborator

@gpetiot gpetiot commented Jun 30, 2021

no diff with test_branch.sh

cc @ulugbekna @voodoos

@ulugbekna
Copy link

Wow, that was quick, thanks! It works like a charm for me so far :-)

@gpetiot gpetiot force-pushed the merlin-typed-holes branch from e77aa73 to e76a254 Compare July 5, 2021 20:27
@gpetiot
Copy link
Collaborator Author

gpetiot commented Jul 5, 2021

Any objection to this being merged @emillon @Julow @hhugo @jberdine ?

Copy link
Collaborator

@Julow Julow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if this has already been considered. Merlin already has a parser that supports this feature and is rebased regularly. What about vendoring merlin's parser ? (without taking advantage of the recovery for now)

@gpetiot
Copy link
Collaborator Author

gpetiot commented Jul 16, 2021

Sorry if this has already been considered. Merlin already has a parser that supports this feature and is rebased regularly. What about vendoring merlin's parser ? (without taking advantage of the recovery for now)

We will make more changes and diverge further from the upstream ocaml parser ([ ] lists soon, type disambiguations, I also want to try a few things for the comments, same for literal strings, add a location to constants, etc.) anyway

@gpetiot gpetiot force-pushed the merlin-typed-holes branch from e76a254 to 8d28cef Compare July 19, 2021 11:10
@gpetiot gpetiot requested a review from Julow July 19, 2021 11:48
@gpetiot gpetiot force-pushed the merlin-typed-holes branch from 8d28cef to 1f858a2 Compare July 19, 2021 12:02
Copy link
Collaborator

@Julow Julow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be useful to have a "hole" case in longident too ?
For example:

  • module_type (module type T = _, or module M : _ in mli)
  • Pexp_field (x._), Pexp_new (new _), module pack ((module _))

It would also supersede Pmod_hole and Pexp_hole and add the hole syntax everywhere it's possible.

This suggestion doesn't make sense for the merlin use case, which only need the current patch. It would be useful for quickly fixing the syntax in order to format and makes the patch easier to rebase (as you said, we are diverging from merlin's parser too).

@gpetiot
Copy link
Collaborator Author

gpetiot commented Jul 19, 2021

I tried doing that, the issue is that the underscore is already a valid rule for patterns, types and modules names, so it creates conflicts in the parser, the modification to solve all of this would be more involved

@Julow
Copy link
Collaborator

Julow commented Jul 19, 2021

The fix is to remove the "any" pattern and type too. My claim that it'll make the patch simpler to rebase might be wrong.

Copy link
Collaborator

@Julow Julow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

4 participants