Skip to content
This repository has been archived by the owner on Feb 27, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants