package merlin-lib
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=376707aa871f09e9639456d3fbe4b89a21c9ad75c774e94cbbbe67f842b0a500
sha512=a11ea4b8e3520b3ee41ae8198cda34b2816b8dfcdcb99350ef29689a7d62bb66d17ffa075c551aa56d521120b55e6db14a106a31f7b3970ed2aa07e1db3c9b88
doc/merlin-lib.ocaml_parsing/Ocaml_parsing/Extend_helper/index.html
Module Ocaml_parsing.Extend_helper
Source
Generate an extension node that will be reported as a syntax error by Merlin.
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
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).
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.
val classify_attribute :
Parsetree.attribute ->
[ `Other | `Relaxed_location | `Hide | `Focus ]