Skip to content

Commit c3ecbe5

Browse files
cristianoczth
authored andcommitted
Small refactor, and store modulePath verbatim.
1 parent ee2d814 commit c3ecbe5

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ let completionForExporteds iterExported getDeclared ~prefix ~exact ~env
562562
with
563563
deprecated = declared.deprecated;
564564
docstring = declared.docstring;
565-
modulePath = ModulePath.toFullPath declared.modulePath;
565+
modulePath = declared.modulePath;
566566
}
567567
:: !res
568568
| _ -> ());
@@ -1358,20 +1358,20 @@ let rec getCompletionsForContextPath ~package ~opens ~rawOpens ~allFiles ~pos
13581358
| [] -> modulePath
13591359
in
13601360
match lhsPath with
1361-
| Some modulePath -> (
1362-
match modulePath with
1361+
| Some lhsPath -> (
1362+
match lhsPath with
13631363
| _ :: _ ->
1364-
let modulePathMinusOpens =
1365-
modulePath
1364+
let lhsPathMinusOpens =
1365+
lhsPath
13661366
|> removeRawOpens package.opens
13671367
|> removeRawOpens rawOpens |> String.concat "."
13681368
in
13691369
let completionName name =
1370-
if modulePathMinusOpens = "" then name
1371-
else modulePathMinusOpens ^ "." ^ name
1370+
if lhsPathMinusOpens = "" then name
1371+
else lhsPathMinusOpens ^ "." ^ name
13721372
in
13731373
let completions =
1374-
modulePath @ [funNamePrefix]
1374+
lhsPath @ [funNamePrefix]
13751375
|> getCompletionsForPath ~completionContext:Value ~exact:false
13761376
~package ~opens ~allFiles ~pos ~env ~scope
13771377
in
@@ -1388,22 +1388,22 @@ let rec getCompletionsForContextPath ~package ~opens ~rawOpens ~allFiles ~pos
13881388
file module name it was found in. We pluck that off here if the env
13891389
we're in is the same as the completion item was found in. This ensures
13901390
that a correct qualified path can be produced. *)
1391-
let modulePath =
1392-
match completionItemModulePath with
1391+
let completionPath =
1392+
match ModulePath.toFullPath completionItemModulePath with
13931393
| topModule :: rest when topModule = env.file.moduleName -> rest
13941394
| modulePath -> modulePath
13951395
in
1396-
let modulePathMinusOpens =
1397-
modulePath
1396+
let completionPathMinusOpens =
1397+
completionPath
13981398
|> removeRawOpens package.opens
13991399
|> removeRawOpens rawOpens |> String.concat "."
14001400
in
14011401
let completionName name =
1402-
if modulePathMinusOpens = "" then name
1403-
else modulePathMinusOpens ^ "." ^ name
1402+
if completionPathMinusOpens = "" then name
1403+
else completionPathMinusOpens ^ "." ^ name
14041404
in
14051405
let completions =
1406-
completionItemModulePath @ [funNamePrefix]
1406+
completionPath @ [funNamePrefix]
14071407
|> getCompletionsForPath ~completionContext:Value ~exact:false
14081408
~package ~opens ~allFiles ~pos ~env ~scope
14091409
in

analysis/src/SharedTypes.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,11 @@ module Completion = struct
263263
deprecated: string option;
264264
docstring: string list;
265265
kind: kind;
266-
modulePath: string list;
266+
modulePath: ModulePath.t;
267267
}
268268

269269
let create ~name ~kind ~env =
270-
{name; env; deprecated = None; docstring = []; kind; modulePath = []}
270+
{name; env; deprecated = None; docstring = []; kind; modulePath = NotVisible}
271271

272272
let createWithModulePath ~name ~kind ~env ~modulePath =
273273
{name; env; deprecated = None; docstring = []; kind; modulePath}

0 commit comments

Comments
 (0)