@@ -503,7 +503,7 @@ let showConstructor {Constructor.cname = {txt}; args; res} =
503
503
| Some typ -> " \n " ^ (typ |> Shared. typeToString)
504
504
505
505
(* TODO: local opens *)
506
- let resolveOpens ~env ~ previous opens ~package =
506
+ let resolveOpens ~env opens ~package =
507
507
List. fold_left
508
508
(fun previous path ->
509
509
(* Finding an open, first trying to find it in previoulsly resolved opens *)
@@ -540,7 +540,7 @@ let resolveOpens ~env ~previous opens ~package =
540
540
Log. log " Was local" ;
541
541
previous @ [env])
542
542
(* loop(previous) *)
543
- previous opens
543
+ [] opens
544
544
545
545
let checkName name ~prefix ~exact =
546
546
if exact then name = prefix else Utils. startsWith name prefix
@@ -1319,11 +1319,6 @@ let rec getCompletionsForContextPath ~package ~opens ~rawOpens ~allFiles ~pos
1319
1319
| Some path -> Some (getModulePath path)
1320
1320
in
1321
1321
let lhsPath = fromType typ in
1322
- let removePackageOpens modulePath =
1323
- match modulePath with
1324
- | toplevel :: rest when package.opens |> List. mem toplevel -> rest
1325
- | _ -> modulePath
1326
- in
1327
1322
let rec removeRawOpen rawOpen modulePath =
1328
1323
match (rawOpen, modulePath) with
1329
1324
| [_], _ -> Some modulePath
@@ -1345,8 +1340,9 @@ let rec getCompletionsForContextPath ~package ~opens ~rawOpens ~allFiles ~pos
1345
1340
match modulePath with
1346
1341
| _ :: _ ->
1347
1342
let modulePathMinusOpens =
1348
- modulePath |> removePackageOpens |> removeRawOpens rawOpens
1349
- |> String. concat " ."
1343
+ modulePath
1344
+ |> removeRawOpens package.opens
1345
+ |> removeRawOpens rawOpens |> String. concat " ."
1350
1346
in
1351
1347
let completionName name =
1352
1348
if modulePathMinusOpens = " " then name
@@ -1369,35 +1365,36 @@ let rec getCompletionsForContextPath ~package ~opens ~rawOpens ~allFiles ~pos
1369
1365
| None -> [] )
1370
1366
| None -> [] )
1371
1367
1372
- let getOpens ~rawOpens ~package ~env =
1373
- Log. log
1374
- (" Raw ppens: "
1375
- ^ string_of_int (List. length rawOpens)
1376
- ^ " "
1377
- ^ String. concat " ... " (rawOpens |> List. map pathToString));
1368
+ let getOpens ~debug ~rawOpens ~package ~env =
1369
+ if debug && rawOpens <> [] then
1370
+ Printf. printf " %s\n "
1371
+ (" Raw opens: "
1372
+ ^ string_of_int (List. length rawOpens)
1373
+ ^ " "
1374
+ ^ String. concat " ... " (rawOpens |> List. map pathToString));
1378
1375
let packageOpens = package.opens in
1379
- Log. log (" Package opens " ^ String. concat " " packageOpens);
1376
+ if debug && packageOpens <> [] then
1377
+ Printf. printf " %s\n "
1378
+ (" Package opens "
1379
+ ^ String. concat " " (packageOpens |> List. map pathToString));
1380
1380
let resolvedOpens =
1381
- resolveOpens ~env
1382
- ~previous:
1383
- (List. map QueryEnv. fromFile
1384
- (packageOpens |> Utils. filterMap (ProcessCmt. fileForModule ~package )))
1385
- (List. rev rawOpens) ~package
1381
+ resolveOpens ~env (List. rev (packageOpens @ rawOpens)) ~package
1386
1382
in
1387
- Log. log
1388
- (" Resolved opens "
1389
- ^ string_of_int (List. length resolvedOpens)
1390
- ^ " "
1391
- ^ String. concat " "
1392
- (resolvedOpens
1393
- |> List. map (fun (e : QueryEnv.t ) -> Uri. toString e.file.uri)));
1383
+ if debug && resolvedOpens <> [] then
1384
+ Printf. printf " %s\n "
1385
+ (" Resolved opens "
1386
+ ^ string_of_int (List. length resolvedOpens)
1387
+ ^ " "
1388
+ ^ String. concat " "
1389
+ (resolvedOpens
1390
+ |> List. map (fun (e : QueryEnv.t ) -> Uri. toString e.file.uri)));
1394
1391
(* Last open takes priority *)
1395
1392
List. rev resolvedOpens
1396
1393
1397
1394
let processCompletable ~debug ~package ~scope ~env ~pos ~forHover
1398
1395
(completable : Completable.t ) =
1399
1396
let rawOpens = Scope. getRawOpens scope in
1400
- let opens = getOpens ~raw Opens ~package ~env in
1397
+ let opens = getOpens ~debug ~ raw Opens ~package ~env in
1401
1398
let allFiles = FileSet. union package.projectFiles package.dependenciesFiles in
1402
1399
let findTypeOfValue path =
1403
1400
path
0 commit comments