File: merlin_helpers.ml

package info (click to toggle)
ppxlib 0.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,284 kB
  • sloc: ml: 17,184; sh: 149; makefile: 36; python: 36
file content (16 lines) | stat: -rw-r--r-- 704 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
open! Import

let mk_attr_noloc txt = Ast_helper.Attr.mk Location.{ txt; loc = none }

let hide_attribute  : attribute = mk_attr_noloc "merlin.hide" (PStr [])
let focus_attribute : attribute = mk_attr_noloc "merlin.focus" (PStr [])

let hide_pattern ({ ppat_attributes ; _ } as p) =
  { p with ppat_attributes = hide_attribute :: ppat_attributes }
let focus_pattern ({ ppat_attributes ; _ } as p) =
  { p with ppat_attributes = focus_attribute :: ppat_attributes }

let hide_expression ({ pexp_attributes ; _ } as e) =
  { e with pexp_attributes = hide_attribute :: pexp_attributes }
let focus_expression ({ pexp_attributes ; _ } as e) =
  { e with pexp_attributes = focus_attribute :: pexp_attributes }