Skip to content

Commit 43b15e8

Browse files
committed
Clean up dump logs
1 parent 6b80247 commit 43b15e8

File tree

2 files changed

+80
-21
lines changed

2 files changed

+80
-21
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,7 @@ let findAllCompletions ~(env : QueryEnv.t) ~prefix ~exact ~namesUsed
352352

353353
let processLocalValue name loc contextPath scope ~prefix ~exact ~env
354354
~(localTables : LocalTables.t) =
355-
if Utils.checkName name ~prefix ~exact then (
356-
print_endline
357-
("processLocalValue name: " ^ name ^ " loc: " ^ Loc.toString loc);
355+
if Utils.checkName name ~prefix ~exact then
358356
match Hashtbl.find_opt localTables.valueTable (name, Loc.start loc) with
359357
| Some declared ->
360358
if not (Hashtbl.mem localTables.namesUsed name) then (
@@ -381,7 +379,7 @@ let processLocalValue name loc contextPath scope ~prefix ~exact ~env
381379
(Ctype.newconstr
382380
(Path.Pident (Ident.create "Type Not Known"))
383381
[]))
384-
:: localTables.resultRev)
382+
:: localTables.resultRev
385383

386384
let processLocalConstructor name loc ~prefix ~exact ~env
387385
~(localTables : LocalTables.t) =
@@ -564,13 +562,12 @@ let findLocalCompletionsForModules ~(localTables : LocalTables.t) ~env ~prefix
564562
let findLocalCompletionsWithOpens ~pos ~(env : QueryEnv.t) ~prefix ~exact ~opens
565563
~scope ~(completionContext : Completable.completionContext) =
566564
(* TODO: handle arbitrary interleaving of opens and local bindings correctly *)
567-
print_endline
565+
Log.log
568566
("findLocalCompletionsWithOpens uri:" ^ Uri.toString env.file.uri ^ " pos:"
569567
^ Pos.toString pos);
570568
let localTables = LocalTables.create () in
571569
match completionContext with
572570
| Value | ValueOrField ->
573-
print_endline "Value or Field";
574571
findLocalCompletionsForValuesAndConstructors ~localTables ~env ~prefix
575572
~exact ~opens ~scope
576573
| Type ->
@@ -616,16 +613,6 @@ let getCompletionsForPath ~debug ~opens ~full ~pos ~exact ~scope
616613
findLocalCompletionsWithOpens ~pos ~env ~prefix ~exact ~opens ~scope
617614
~completionContext
618615
in
619-
print_endline
620-
("localCompletionsWithOpens: "
621-
^ (List.map
622-
(fun c ->
623-
match c.Completion.sortText with
624-
| None -> c.Completion.name
625-
| Some insertText -> c.Completion.name ^ " " ^ insertText)
626-
localCompletionsWithOpens
627-
|> String.concat ","));
628-
629616
let fileModules =
630617
allFiles |> FileSet.elements
631618
|> Utils.filterMap (fun name ->
@@ -789,7 +776,7 @@ let completionsGetCompletionType ~full completions =
789776
| _ -> None
790777

791778
(**
792-
Returns completions from the current module where `include OtherModule` is present.
779+
Returns completions from the current module where `include OtherModule()` is present.
793780
*)
794781
let completionsFromIncludedModule ~full ~env ~pos =
795782
(* Get the path of the module where the cursor is.*)
@@ -808,10 +795,8 @@ let completionsFromIncludedModule ~full ~env ~pos =
808795
let ownerPath =
809796
ModulePath.toPathWithPrefix ownerPath full.file.File.moduleName
810797
in
811-
Format.printf "ownerPath: %s \n" (ownerPath |> String.concat ".");
812-
if ownerPath = ownModule then (
813-
print_endline "hit";
814-
Some (Completion.create name.txt ~env ~kind:(Value item)))
798+
if ownerPath = ownModule then
799+
Some (Completion.create name.txt ~env ~kind:(Value item))
815800
else None
816801
| _ -> None)
817802

tests/analysis_tests/tests/src/expected/DotPipeCompleteFromCurrentModule.res.txt

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,77 @@ Path
3030
}]
3131
}]
3232

33+
Complete src/DotPipeCompleteFromCurrentModule.res 60:17
34+
posCursor:[60:17] posNoWhite:[60:16] Found expr:[58:15->63:5]
35+
posCursor:[60:17] posNoWhite:[60:16] Found expr:[59:8->62:9]
36+
posCursor:[60:17] posNoWhite:[60:16] Found expr:[60:15->60:17]
37+
Pexp_field [60:15->60:16] _:[62:8->60:17]
38+
Completable: Cpath Value[k].""
39+
Package opens Stdlib.place holder Pervasives.JsxModules.place holder
40+
Resolved opens 1 Stdlib
41+
ContextPath Value[k].""
42+
ContextPath Value[k]
43+
Path k
44+
ContextPath Value[k]->
45+
ContextPath Value[k]
46+
Path k
47+
CPPipe pathFromEnv:Types found:true
48+
Path Types.
49+
Path
50+
[{
51+
"label": "->addPosFromVec2",
52+
"kind": 12,
53+
"tags": [],
54+
"detail": "(Types.context, Types.vec2) => Types.comp",
55+
"documentation": null,
56+
"sortText": "addPosFromVec2",
57+
"insertText": "->addPosFromVec2",
58+
"additionalTextEdits": [{
59+
"range": {"start": {"line": 60, "character": 16}, "end": {"line": 60, "character": 17}},
60+
"newText": ""
61+
}]
62+
}, {
63+
"label": "->addPos",
64+
"kind": 12,
65+
"tags": [],
66+
"detail": "(Types.context, float, float) => Types.comp",
67+
"documentation": null,
68+
"sortText": "addPos",
69+
"insertText": "->addPos",
70+
"additionalTextEdits": [{
71+
"range": {"start": {"line": 60, "character": 16}, "end": {"line": 60, "character": 17}},
72+
"newText": ""
73+
}]
74+
}]
75+
76+
Complete src/DotPipeCompleteFromCurrentModule.res 72:21
77+
posCursor:[72:21] posNoWhite:[72:20] Found expr:[70:19->75:9]
78+
posCursor:[72:21] posNoWhite:[72:20] Found expr:[71:12->74:13]
79+
posCursor:[72:21] posNoWhite:[72:20] Found expr:[72:19->72:21]
80+
Pexp_field [72:19->72:20] _:[74:12->72:21]
81+
Completable: Cpath Value[k].""
82+
Package opens Stdlib.place holder Pervasives.JsxModules.place holder
83+
Resolved opens 1 Stdlib
84+
ContextPath Value[k].""
85+
ContextPath Value[k]
86+
Path k
87+
ContextPath Value[k]->
88+
ContextPath Value[k]
89+
Path k
90+
CPPipe pathFromEnv:Types found:true
91+
Path Types.
92+
Path
93+
[{
94+
"label": "->addSprite",
95+
"kind": 12,
96+
"tags": [],
97+
"detail": "(Types.context, string) => Types.comp",
98+
"documentation": null,
99+
"sortText": "addSprite",
100+
"insertText": "->addSprite",
101+
"additionalTextEdits": [{
102+
"range": {"start": {"line": 72, "character": 20}, "end": {"line": 72, "character": 21}},
103+
"newText": ""
104+
}]
105+
}]
106+

0 commit comments

Comments
 (0)