Skip to content

Add support for destruct #97

Open
Open
@Khady

Description

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.

Activity

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

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions