Skip to content

Commit 39a1db5

Browse files
committed
Revert other changes and commit test result
1 parent 854db1d commit 39a1db5

File tree

3 files changed

+560
-79
lines changed

3 files changed

+560
-79
lines changed

analysis/src/SharedTypes.ml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -689,20 +689,20 @@ module Completable = struct
689689
| CPAwait ctxPath -> "await " ^ contextPathToString ctxPath
690690
| CPOption ctxPath -> "option<" ^ contextPathToString ctxPath ^ ">"
691691
| CPApply (cp, labels) ->
692-
"CPApply(" ^ contextPathToString cp ^ "("
692+
contextPathToString cp ^ "("
693693
^ (labels
694694
|> List.map (function
695695
| Asttypes.Noloc.Nolabel -> "Nolabel"
696696
| Labelled s -> "~" ^ s
697697
| Optional s -> "?" ^ s)
698698
|> String.concat ", ")
699-
^ "))"
699+
^ ")"
700700
| CPArray (Some ctxPath) -> "array<" ^ contextPathToString ctxPath ^ ">"
701701
| CPArray None -> "array"
702702
| CPId {path; completionContext} ->
703-
"CPID(" ^ completionContextToString completionContext ^ list path ^ ")"
703+
completionContextToString completionContext ^ list path
704704
| CPField {contextPath = cp; fieldName = s} ->
705-
"CPField(" ^ contextPathToString cp ^ "." ^ str s ^ ")"
705+
contextPathToString cp ^ "." ^ str s
706706
| CPObj (cp, s) -> contextPathToString cp ^ "[\"" ^ s ^ "\"]"
707707
| CPPipe {contextPath; id; inJsx} ->
708708
contextPathToString contextPath
@@ -801,19 +801,6 @@ module Completion = struct
801801
| ExtractedType of completionType * [`Value | `Type]
802802
| FollowContextPath of Completable.contextPath * ScopeTypes.item list
803803

804-
let kind_to_string = function
805-
| Module _ -> "Module"
806-
| Value _ -> "Value"
807-
| ObjLabel _ -> "ObjLabel"
808-
| Label _ -> "Label"
809-
| Type _ -> "Type"
810-
| Constructor _ -> "Constructor"
811-
| PolyvariantConstructor _ -> "PolyvariantConstructor"
812-
| Field _ -> "Field"
813-
| FileModule _ -> "FileModule"
814-
| Snippet _ -> "Snippet"
815-
| ExtractedType _ -> "ExtractedType"
816-
| FollowContextPath _ -> "FollowContextPath"
817804
type t = {
818805
name: string;
819806
sortText: string option;
@@ -832,10 +819,6 @@ module Completion = struct
832819
(** Whether this item is an made up, synthetic item or not. *)
833820
}
834821

835-
let toString (t : t) : string =
836-
Format.sprintf "Completion: %s %s %b" t.name (kind_to_string t.kind)
837-
t.synthetic
838-
839822
let create ?(synthetic = false) ?additionalTextEdits ?data ?typeArgContext
840823
?(includesSnippets = false) ?insertText ~kind ~env ?sortText ?deprecated
841824
?filterText ?detail ?(docstring = []) name =

analysis/src/TypeUtils.ml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,6 @@ let extractFunctionType ~env ~package typ =
262262
in
263263
loop ~env [] typ
264264

265-
let rec extracReturnTypeButDontDoAnyAliasLookup (typ : Types.type_expr) :
266-
Types.type_expr =
267-
match typ.desc with
268-
| Types.Tarrow (_, _t1, t2, _, _) ->
269-
extracReturnTypeButDontDoAnyAliasLookup t2
270-
| _ -> typ
271-
272265
let extractFunctionTypeWithEnv ~env ~package typ =
273266
let rec loop ~env acc (t : Types.type_expr) =
274267
match t.desc with
@@ -515,7 +508,6 @@ let rec digToRelevantTemplateNameType ~env ~package ?(suffix = "")
515508

516509
let rec resolveTypeForPipeCompletion ~env ~package ~lhsLoc ~full
517510
(t : Types.type_expr) =
518-
if Debug.verbose () then print_endline "Enter resolveTypeForPipeCompletion:";
519511
(* If the type we're completing on is a type parameter, we won't be able to
520512
do completion unless we know what that type parameter is compiled as.
521513
This attempts to look up the compiled type for that type parameter by
@@ -1175,7 +1167,7 @@ let transformCompletionToPipeCompletion ?(synthetic = false) ~env ?posOfDot
11751167
of the project. Example: type x in module SomeModule in file SomeFile would get the globally
11761168
unique id `SomeFile.SomeModule.x`.*)
11771169
let rec findRootTypeId ~full ~env (t : Types.type_expr) =
1178-
let debug = Debug.verbose () in
1170+
let debug = false in
11791171
match t.desc with
11801172
| Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> findRootTypeId ~full ~env t1
11811173
| Tconstr (path, _, _) -> (
@@ -1216,11 +1208,8 @@ let filterPipeableFunctions ~env ~full ?synthetic ?targetTypeId ?posOfDot
12161208
match targetTypeId with
12171209
| None -> completions
12181210
| Some targetTypeId ->
1219-
if Debug.verbose () then Format.printf "targetTypeId: %s\n" targetTypeId;
12201211
completions
12211212
|> List.filter_map (fun (completion : Completion.t) ->
1222-
if Debug.verbose () then
1223-
print_endline (Completion.toString completion);
12241213
let thisCompletionItemTypeId =
12251214
match completion.kind with
12261215
| Value t -> (

0 commit comments

Comments
 (0)