package merlin-extend

  1. Overview
  2. Docs
A protocol to provide custom frontend to Merlin

Install

Dune Dependency

Authors

Maintainers

Sources

merlin-extend-0.6.1.tbz
sha256=5ec84b355ddb2d129a5948b132bfacc93adcbde2158c7de695f7bfc3650bead7
sha512=631fc96aab2f35e12a078c9b4907ca7b0db9f1e3a4026040e6c23b82e0171c256a89fb5d4c887f1d156eb9e3152783cdf7a546b2496051007a1bcf5777417396

doc/merlin-extend/Extend_helper/index.html

Module Extend_helperSource

Sourceval print_outcome_using_oprint : Format.formatter -> Extend_protocol.Reader.outcometree -> unit

Default implementation for Reader_def.print_outcome using Oprint from compiler-libs

Sourceval syntax_error : string -> Location.t -> Parsetree.extension

Generate an extension node that will be reported as a syntax error by Merlin.

Sourceval relaxed_location : Location.t -> Parsetree.attribute

Physical locations might be too precise for some features.

For instance in: let x = f in y ^1 ^2

Merlin cannot distinguish position ^1 from ^2 in the normal AST, because IN doesn't appear in abstract syntax. This is a problem when completing, because a different environment should be selected for both positions.

One can add relaxed_location attributes to make some locations closer to the concrete syntax.

Here is the same line annotated with physical and relaxed locations: let x = f in y -- physical locations for f and y nodes -- relaxed locations for f and y nodes

Sourceval hide_node : Parsetree.attribute

If some code should be ignored by merlin when reporting information to the user, put a hide_node attribute.

This is useful for generated/desugared code which doesn't correspond to anything in concrete syntax (example use-case: encoding of some js_of_ocaml constructs).

Sourceval focus_node : Parsetree.attribute

The converse: when merlin should focus on a specific node of the AST. The main use case is also for js_of_ocaml.

Assuming <code> is translated to:

let module M = struct let prolog = ... (* boilerplate *)

let code = <mapping-of-code>

let epilog = ... (* boilerplate *) end in M.boilerplate

To make merlin focus on M.code and ignore the boilerplate (M.prolog and M.epilog), add a focus_node attribute to the M.code item.

Sourceval classify_extension : Parsetree.extension -> [ `Other | `Syntax_error ]
Sourceval extract_syntax_error : Parsetree.extension -> string * Location.t
Sourceval classify_attribute : Parsetree.attribute -> [ `Other | `Relaxed_location | `Hide | `Focus ]
Sourceval extract_relaxed_location : Parsetree.attribute -> Location.t
OCaml

Innovation. Community. Security.