Skip to content

Commit e57c7ef

Browse files
committed
cleanup
1 parent 8851a6b commit e57c7ef

File tree

4 files changed

+7
-35
lines changed

4 files changed

+7
-35
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,6 @@ let getPipeCompletions ~env ~full ~identifierLoc ~debug ~envCompletionIsMadeFrom
702702
TypeUtils.completionPathFromMaybeBuiltin t ~package:full.package
703703
| None -> None
704704
in
705-
(* TODO(in-compiler) No need to have this configurable anymore, just use the new integrated modules from Core..*)
706705
let completionPath =
707706
match (completeAsBuiltin, typePath) with
708707
| Some completionPathForBuiltin, _ -> Some completionPathForBuiltin
@@ -1099,22 +1098,11 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
10991098
~completionContext:Field ~env ~scope
11001099
| CPField {contextPath = cp; fieldName; fieldNameLoc} -> (
11011100
if Debug.verbose () then print_endline "[dot_completion]--> Triggered";
1102-
(* This finds completions for the context path of the field completion.
1103-
From this, we assume that the first found completion represents the type
1104-
of the field parent. So in `someRecordValue.f`, we find the type of `someRecordValue`.
1105-
1106-
This procedure is how finding types works in general in the tooling as of
1107-
now. *)
11081101
let completionsFromCtxPath =
11091102
cp
11101103
|> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env
11111104
~exact:true ~scope
11121105
in
1113-
(* This extracts the type expr and env from the first found completion, if it's
1114-
a type expr. For dot completion, a type expr is the only relevant type we care
1115-
about here, since that will point to a type, either record or other type, of which
1116-
we can look up the module and any annotations for.
1117-
*)
11181106
let mainTypeCompletionEnv =
11191107
completionsFromCtxPath
11201108
|> completionsGetTypeEnv2 ~debug ~full ~opens ~rawOpens ~pos

analysis/src/DotCompletionUtils.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ let fieldCompletionsForDotCompletion typ ~env ~package ~prefix ~fieldNameLoc
2727
else None)
2828
| None -> (
2929
match typ |> TypeUtils.extractRecordType ~env ~package with
30-
| Some (env, fields, typDecl, _path, _attributes) ->
30+
| Some (env, fields, typDecl) ->
3131
fields
3232
|> filterRecordFields ~env ~prefix ~exact
3333
~recordAsString:

analysis/src/ProcessAttributes.ml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,7 @@ let newDeclared ~item ~extent ~name ~stamp ~modulePath isExported attributes =
4949
item;
5050
}
5151

52-
let rec findEditorCompleteFromAttribute attributes =
53-
let open Parsetree in
54-
match attributes with
55-
| [] -> None
56-
| ( {Asttypes.txt = "editor.completeFrom"},
57-
PStr
58-
[
59-
{
60-
pstr_desc =
61-
Pstr_eval ({pexp_desc = Pexp_construct ({txt = path}, None)}, _);
62-
};
63-
] )
64-
:: _ ->
65-
Some (Utils.flattenLongIdent path)
66-
| _ :: rest -> findEditorCompleteFromAttribute rest
67-
68-
let rec findEditorCompleteFromAttribute2 ?(modulePaths = []) attributes =
52+
let rec findEditorCompleteFromAttribute ?(modulePaths = []) attributes =
6953
let open Parsetree in
7054
match attributes with
7155
| [] -> modulePaths
@@ -85,7 +69,7 @@ let rec findEditorCompleteFromAttribute2 ?(modulePaths = []) attributes =
8569
Some (Utils.flattenLongIdent path)
8670
| _ -> None)
8771
in
88-
findEditorCompleteFromAttribute2
72+
findEditorCompleteFromAttribute
8973
~modulePaths:(modulePathsFromArray @ modulePaths)
9074
rest
91-
| _ :: rest -> findEditorCompleteFromAttribute2 ~modulePaths rest
75+
| _ :: rest -> findEditorCompleteFromAttribute ~modulePaths rest

analysis/src/TypeUtils.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ let rec extractRecordType ~env ~package (t : Types.type_expr) =
209209
| Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> extractRecordType ~env ~package t1
210210
| Tconstr (path, typeArgs, _) -> (
211211
match References.digConstructor ~env ~package path with
212-
| Some (env, ({item = {kind = Record fields; attributes}} as typ)) ->
212+
| Some (env, ({item = {kind = Record fields}} as typ)) ->
213213
let typeParams = typ.item.decl.type_params in
214214
let fields =
215215
fields
@@ -219,7 +219,7 @@ let rec extractRecordType ~env ~package (t : Types.type_expr) =
219219
in
220220
{field with typ = fieldTyp})
221221
in
222-
Some (env, fields, typ, path, attributes)
222+
Some (env, fields, typ)
223223
| Some
224224
( env,
225225
{item = {decl = {type_manifest = Some t1; type_params = typeParams}}}
@@ -1108,7 +1108,7 @@ module StringSet = Set.Make (String)
11081108
let getExtraModulesToCompleteFromForType ~env ~full (t : Types.type_expr) =
11091109
let foundModulePaths = ref StringSet.empty in
11101110
let addToModulePaths attributes =
1111-
ProcessAttributes.findEditorCompleteFromAttribute2 attributes
1111+
ProcessAttributes.findEditorCompleteFromAttribute attributes
11121112
|> List.iter (fun e ->
11131113
foundModulePaths :=
11141114
StringSet.add (e |> String.concat ".") !foundModulePaths)

0 commit comments

Comments
 (0)