@@ -203,6 +203,29 @@ pub fn generate_asts(
203
203
namespaces:: compile_mlmap ( package, module_name, & build_state. bsc_path ) ;
204
204
let mlmap_hash_after = helpers:: compute_file_hash ( & compile_path) ;
205
205
206
+ let suffix = package
207
+ . namespace
208
+ . to_suffix ( )
209
+ . expect ( "namespace should be set for mlmap module" ) ;
210
+ // copy the mlmap to the bs build path for editor tooling
211
+ let base_build_path = package. get_build_path ( ) + "/" + & suffix;
212
+ let base_bs_build_path = package. get_bs_build_path ( ) + "/" + & suffix;
213
+ let _ = std:: fs:: copy (
214
+ base_build_path. to_string ( ) + ".cmi" ,
215
+ base_bs_build_path. to_string ( ) + ".cmi" ,
216
+ ) ;
217
+ let _ = std:: fs:: copy (
218
+ base_build_path. to_string ( ) + ".cmt" ,
219
+ base_bs_build_path. to_string ( ) + ".cmt" ,
220
+ ) ;
221
+ let _ = std:: fs:: copy (
222
+ base_build_path. to_string ( ) + ".cmj" ,
223
+ base_bs_build_path. to_string ( ) + ".cmj" ,
224
+ ) ;
225
+ let _ = std:: fs:: copy (
226
+ base_build_path. to_string ( ) + ".mlmap" ,
227
+ base_bs_build_path. to_string ( ) + ".mlmap" ,
228
+ ) ;
206
229
match ( mlmap_hash, mlmap_hash_after) {
207
230
( Some ( digest) , Some ( digest_after) ) => !digest. eq ( & digest_after) ,
208
231
_ => true ,
@@ -299,7 +322,7 @@ fn generate_ast(
299
322
) ;
300
323
301
324
/* Create .ast */
302
- if let Some ( res_to_ast) = Some (
325
+ let result = if let Some ( res_to_ast) = Some (
303
326
Command :: new ( bsc_path)
304
327
. current_dir ( & build_path_abs)
305
328
. args ( parser_args)
@@ -322,7 +345,20 @@ fn generate_ast(
322
345
"Could not find canonicalize_string_path for file {} in package {}" ,
323
346
filename, package. name
324
347
) )
348
+ } ;
349
+ match & result {
350
+ Ok ( ( ast_path, _) ) => {
351
+ let dir = std:: path:: Path :: new ( filename) . parent ( ) . unwrap ( ) ;
352
+ let _ = std:: fs:: copy (
353
+ build_path_abs. to_string ( ) + "/" + ast_path,
354
+ std:: path:: Path :: new ( & package. get_bs_build_path ( ) )
355
+ . join ( dir)
356
+ . join ( ast_path) ,
357
+ ) ;
358
+ }
359
+ Err ( _) => ( ) ,
325
360
}
361
+ result
326
362
}
327
363
328
364
fn path_to_ast_extension ( path : & Path ) -> & str {
0 commit comments