@@ -51,6 +51,7 @@ module Context = struct
51
51
; fdo_target_exe : Path .t option
52
52
; dynamically_linked_foreign_archives : bool
53
53
; instrument_with : Lib_name .t list
54
+ ; merlin : bool
54
55
}
55
56
56
57
let to_dyn = Dyn.Encoder. opaque
@@ -67,6 +68,7 @@ module Context = struct
67
68
; fdo_target_exe
68
69
; dynamically_linked_foreign_archives
69
70
; instrument_with
71
+ ; merlin
70
72
} t =
71
73
Profile. equal profile t.profile
72
74
&& List. equal Target. equal targets t.targets
@@ -81,6 +83,7 @@ module Context = struct
81
83
&& Bool. equal dynamically_linked_foreign_archives
82
84
t.dynamically_linked_foreign_archives
83
85
&& List. equal Lib_name. equal instrument_with t.instrument_with
86
+ && Bool. equal merlin t.merlin
84
87
85
88
let fdo_suffix t =
86
89
match t.fdo_target_exe with
@@ -140,7 +143,8 @@ module Context = struct
140
143
and + instrument_with =
141
144
field ~default: instrument_with " instrument_with"
142
145
(Dune_lang.Syntax. since syntax (2 , 7 ) >>> repeat Lib_name. decode)
143
- and + loc = loc in
146
+ and + loc = loc
147
+ and + merlin = field_b " merlin" in
144
148
Option. iter host_context ~f: (fun _ ->
145
149
match targets with
146
150
| [ Target. Native ] -> ()
@@ -161,6 +165,7 @@ module Context = struct
161
165
; fdo_target_exe
162
166
; dynamically_linked_foreign_archives
163
167
; instrument_with
168
+ ; merlin
164
169
}
165
170
end
166
171
@@ -169,29 +174,25 @@ module Context = struct
169
174
{ base : Common .t
170
175
; switch : string
171
176
; root : string option
172
- ; merlin : bool
173
177
}
174
178
175
- let to_dyn { base; switch; root; merlin } =
179
+ let to_dyn { base; switch; root } =
176
180
let open Dyn.Encoder in
177
181
record
178
182
[ (" base" , Common. to_dyn base)
179
183
; (" switch" , string switch)
180
184
; (" root" , option string root)
181
- ; (" merlin" , bool merlin)
182
185
]
183
186
184
- let equal { base; switch; root; merlin } t =
187
+ let equal { base; switch; root } t =
185
188
Common. equal base t.base
186
189
&& String. equal switch t.switch
187
190
&& Option. equal String. equal root t.root
188
- && Bool. equal merlin t.merlin
189
191
190
192
let t ~profile ~instrument_with ~x =
191
193
let + loc_switch, switch = field " switch" (located string )
192
194
and + name = field_o " name" Context_name. decode
193
195
and + root = field_o " root" string
194
- and + merlin = field_b " merlin"
195
196
and + base = Common. t ~profile ~instrument_with in
196
197
let name =
197
198
match name with
@@ -209,7 +210,7 @@ module Context = struct
209
210
])
210
211
in
211
212
let base = { base with targets = Target. add base.targets x; name } in
212
- { base; switch; root; merlin }
213
+ { base; switch; root }
213
214
end
214
215
215
216
module Default = struct
@@ -306,6 +307,7 @@ module Context = struct
306
307
; fdo_target_exe = None
307
308
; dynamically_linked_foreign_archives = true
308
309
; instrument_with = Option. value instrument_with ~default: []
310
+ ; merlin = false
309
311
}
310
312
end
311
313
@@ -418,10 +420,13 @@ let t ?x ?profile:cmdline_profile ?instrument_with:cmdline_instrument_with () =
418
420
Context_name.Set. union ! defined_names
419
421
(Context_name.Set. of_list (Context. all_names ctx));
420
422
match (ctx, acc) with
421
- | Opam { merlin = true ; _ } , Some _ ->
423
+ | Opam { base = { merlin = true ; _ }; _ }, Some _
424
+ | Default { merlin = true ; _ } , Some _ ->
422
425
User_error. raise ~loc: (Context. loc ctx)
423
426
[ Pp. text " you can only have one context for merlin" ]
424
- | Opam { merlin = true ; _ } , None -> Some name
427
+ | Opam { base = { merlin = true ; _ }; _ }, None
428
+ | Default { merlin = true ; _ } , None ->
429
+ Some name
425
430
| _ -> acc)
426
431
in
427
432
let contexts =
0 commit comments