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

Add support for destruct #97

Open
Khady opened this issue May 25, 2017 · 0 comments
Open

Add support for destruct #97

Khady opened this issue May 25, 2017 · 0 comments

Comments

@Khady
Copy link

Khady commented May 25, 2017

Merlin is able to destruct a value to create a pattern matching on it. It would be nice to support this feature

Example:

let () =
  let a = Some 1 in
  a<CURSOR>

After calling destruct becomes

let () =
  let a = Some 1 in
  (match a with | None  -> (??) | Some _ -> (??))

From merlin documentation:

["case","analysis","from",position,"to",position]

Try to destruct patterns in the specified range. It returns a value with the shape [{"start": position, "end": position}, content]. The editor is expected to replace content between start and end by content.

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

No branches or pull requests

2 participants