@@ -302,12 +302,15 @@ let findRelativePath ~rootPath ~path =
302
302
303
303
let getSource ~rootPath ({loc_start} : Location.t ) =
304
304
let line, col = Pos. ofLexing loc_start in
305
-
306
305
let filepath = findRelativePath ~root Path ~path: loc_start.pos_fname in
307
-
308
306
{filepath; line = line + 1 ; col = col + 1 }
309
307
310
- let extractDocs ~path ~debug =
308
+ let extractDocs ~entryPointFile ~debug =
309
+ let path =
310
+ match Filename. is_relative entryPointFile with
311
+ | true -> Unix. realpath entryPointFile
312
+ | false -> entryPointFile
313
+ in
311
314
if debug then Printf. printf " extracting docs for %s\n " path;
312
315
let result =
313
316
match
@@ -362,9 +365,9 @@ let extractDocs ~path ~debug =
362
365
items =
363
366
structure.items
364
367
|> List. filter_map (fun (item : Module.item ) ->
368
+ let source = getSource ~root Path item.loc in
365
369
match item.kind with
366
370
| Value typ ->
367
- let source = getSource ~root Path item.loc in
368
371
Some
369
372
(Value
370
373
{
@@ -376,8 +379,6 @@ let extractDocs ~path ~debug =
376
379
name = item.name;
377
380
deprecated = item.deprecated;
378
381
source;
379
- (* source = *)
380
- (* getSource ~stamp:typ.id ~full ~name:item.name; *)
381
382
})
382
383
| Type (typ , _ ) ->
383
384
Some
@@ -390,7 +391,7 @@ let extractDocs ~path ~debug =
390
391
name = item.name;
391
392
deprecated = item.deprecated;
392
393
detail = typeDetail typ ~full ~env ;
393
- source = getSource ~root Path item.loc ;
394
+ source;
394
395
})
395
396
| Module (Ident p ) ->
396
397
(* module Whatever = OtherModule *)
@@ -416,7 +417,7 @@ let extractDocs ~path ~debug =
416
417
{
417
418
id;
418
419
name = item.name;
419
- source = getSource ~root Path item.loc ;
420
+ source;
420
421
items;
421
422
docstring =
422
423
item.docstring @ internalDocstrings
@@ -433,7 +434,7 @@ let extractDocs ~path ~debug =
433
434
name = m.name;
434
435
docstring = item.docstring @ m.docstring;
435
436
deprecated = item.deprecated;
436
- source = getSource ~root Path item.loc ;
437
+ source;
437
438
items = docs.items;
438
439
})
439
440
| Module
0 commit comments