File tree Expand file tree Collapse file tree 1 file changed +18
-14
lines changed Expand file tree Collapse file tree 1 file changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -214,26 +214,30 @@ module Processed = struct
214214 Path.Set. to_list_map hidden_src_dirs ~f: (make_directive_of_path " SH" )
215215 in
216216 let flags =
217- let flags =
218- match flags with
217+ (* Order matters here. The flags should be communicated to Merlin in the
218+ same order that they are passed to the compiler: user flags, pp flags
219+ and then opens *)
220+ let open_flags =
221+ match opens with
219222 | [] -> []
220- | flags ->
221- [ make_directive " FLG" (Sexp. List (List. map ~f: (fun s -> Sexp. Atom s) flags)) ]
223+ | opens ->
224+ let open_flags =
225+ Ocaml_flags. open_flags opens |> List. map ~f: (fun x -> Sexp. Atom x)
226+ in
227+ [ make_directive " FLG" (Sexp. List open_flags) ]
222228 in
223- let flags =
229+ let other_flags =
224230 match pp with
225- | None -> flags
231+ | None -> open_flags
226232 | Some { flag; args } ->
227233 make_directive " FLG" (Sexp. List [ Atom (Pp_kind. to_flag flag); Atom args ])
228- :: flags
234+ :: open_flags
229235 in
230- match opens with
231- | [] -> flags
232- | opens ->
233- make_directive
234- " FLG"
235- (Sexp. List (Ocaml_flags. open_flags opens |> List. map ~f: (fun x -> Sexp. Atom x)))
236- :: flags
236+ match flags with
237+ | [] -> other_flags
238+ | flags ->
239+ make_directive " FLG" (Sexp. List (List. map ~f: (fun s -> Sexp. Atom s) flags))
240+ :: other_flags
237241 in
238242 let unit_name = [ make_directive " UNIT_NAME" (Sexp. Atom unit_name) ] in
239243 let suffixes =
You can’t perform that action at this time.
0 commit comments