Skip to content

Commit 24d0a37

Browse files
committed
Print Path
1 parent 5e561c9 commit 24d0a37

25 files changed

+452
-9
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,9 @@ let getComplementaryCompletionsForTypedValue ~opens ~allFiles ~scope ~env prefix
510510
in
511511
localCompletionsWithOpens @ fileModules
512512

513-
let getCompletionsForPath ~package ~opens ~allFiles ~pos ~exact ~scope
513+
let getCompletionsForPath ~debug ~package ~opens ~allFiles ~pos ~exact ~scope
514514
~completionContext ~env path =
515+
if debug then Printf.printf "Path %s\n" (path |> String.concat ".");
515516
match path with
516517
| [] -> []
517518
| [prefix] ->
@@ -737,7 +738,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
737738
])
738739
| CPId (path, completionContext) ->
739740
path
740-
|> getCompletionsForPath ~package ~opens ~allFiles ~pos ~exact
741+
|> getCompletionsForPath ~debug ~package ~opens ~allFiles ~pos ~exact
741742
~completionContext ~env ~scope
742743
| CPApply (cp, labels) -> (
743744
match
@@ -784,7 +785,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
784785
| CPField (CPId (path, Module), fieldName) ->
785786
(* M.field *)
786787
path @ [fieldName]
787-
|> getCompletionsForPath ~package ~opens ~allFiles ~pos ~exact
788+
|> getCompletionsForPath ~debug ~package ~opens ~allFiles ~pos ~exact
788789
~completionContext:Field ~env ~scope
789790
| CPField (cp, fieldName) -> (
790791
let completionsForCtxPath =
@@ -952,7 +953,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
952953
in
953954
let completions =
954955
completionPath @ [funNamePrefix]
955-
|> getCompletionsForPath ~completionContext:Value ~exact:false
956+
|> getCompletionsForPath ~debug ~completionContext:Value ~exact:false
956957
~package ~opens ~allFiles ~pos ~env ~scope
957958
in
958959
let completions =
@@ -1016,8 +1017,8 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
10161017
| CJsxPropValue {pathToComponent; propName} -> (
10171018
let findTypeOfValue path =
10181019
path
1019-
|> getCompletionsForPath ~completionContext:Value ~exact:true ~package
1020-
~opens ~allFiles ~pos ~env ~scope
1020+
|> getCompletionsForPath ~debug ~completionContext:Value ~exact:true
1021+
~package ~opens ~allFiles ~pos ~env ~scope
10211022
|> completionsGetTypeEnv2 ~debug ~full ~opens ~rawOpens ~allFiles ~pos
10221023
~scope
10231024
in
@@ -1031,7 +1032,7 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos
10311032
let rec digToTypeForCompletion path =
10321033
match
10331034
path
1034-
|> getCompletionsForPath ~completionContext:Type ~exact:true
1035+
|> getCompletionsForPath ~debug ~completionContext:Type ~exact:true
10351036
~package ~opens ~allFiles ~pos ~env ~scope
10361037
with
10371038
| {kind = Type {kind = Abstract (Some (p, _))}} :: _ ->
@@ -1412,8 +1413,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable =
14121413
let allFiles = FileSet.union package.projectFiles package.dependenciesFiles in
14131414
let findTypeOfValue path =
14141415
path
1415-
|> getCompletionsForPath ~completionContext:Value ~exact:true ~package
1416-
~opens ~allFiles ~pos ~env ~scope
1416+
|> getCompletionsForPath ~debug ~completionContext:Value ~exact:true
1417+
~package ~opens ~allFiles ~pos ~env ~scope
14171418
|> completionsGetTypeEnv2 ~debug ~full ~opens ~rawOpens ~allFiles ~pos
14181419
~scope
14191420
in

analysis/tests/src/expected/BrokenParserCases.res.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ posCursor:[2:24] posNoWhite:[2:23] Found expr:[2:11->2:30]
33
Pexp_apply ...[2:11->2:17] (~isOff2:19->2:24=...[2:27->2:29])
44
Completable: CnamedArg(Value[someFn], isOff, [isOff])
55
ContextPath Value[someFn]
6+
Path someFn
67
[]
78

89
Complete src/BrokenParserCases.res 6:17
910
posCursor:[6:17] posNoWhite:[6:16] Found pattern:[6:16->6:19]
1011
Completable: Cpattern Value[s]=t
1112
ContextPath Value[s]
13+
Path s
1214
[]
1315

1416
Complete src/BrokenParserCases.res 10:29
@@ -17,5 +19,6 @@ posCursor:[10:29] posNoWhite:[10:27] Found pattern:[10:24->10:28]
1719
Ppat_construct None:[10:24->10:28]
1820
Completable: Cpath Value[None]
1921
ContextPath Value[None]
22+
Path None
2023
[]
2124

analysis/tests/src/expected/CompletePrioritize1.res.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ posCursor:[5:6] posNoWhite:[5:5] Found expr:[5:3->0:-1]
33
Completable: Cpath Value[a]->
44
ContextPath Value[a]->
55
ContextPath Value[a]
6+
Path a
7+
Path Test.
68
[{
79
"label": "Test.add",
810
"kind": 12,

analysis/tests/src/expected/CompletePrioritize2.res.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ posCursor:[9:7] posNoWhite:[9:6] Found expr:[9:3->0:-1]
33
Completable: Cpath Value[ax]->
44
ContextPath Value[ax]->
55
ContextPath Value[ax]
6+
Path ax
7+
Path Test.
68
[{
79
"label": "Test.add",
810
"kind": 12,
@@ -16,6 +18,7 @@ posCursor:[12:5] posNoWhite:[12:4] Found expr:[12:3->12:5]
1618
Pexp_ident ax:[12:3->12:5]
1719
Completable: Cpath Value[ax]
1820
ContextPath Value[ax]
21+
Path ax
1922
[{
2023
"label": "ax",
2124
"kind": 12,

0 commit comments

Comments
 (0)