Skip to content

Commit 1d09ab3

Browse files
committed
refactor
1 parent 7a368ce commit 1d09ab3

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

analysis/src/Commands.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ let completion ~debug ~path ~pos ~currentFile ~forHover =
44
match textOpt with
55
| None | Some "" -> []
66
| Some text ->
7-
let completionItems =
7+
let completions =
88
match
99
Completion.completionWithParser ~debug ~path ~posCursor:pos
1010
~currentFile ~text
@@ -24,7 +24,7 @@ let completion ~debug ~path ~pos ~currentFile ~forHover =
2424
|> NewCompletions.processCompletable ~debug ~package ~pos ~scope
2525
~env ~forHover)
2626
in
27-
completionItems
27+
completions |> List.map NewCompletions.completionToItem
2828
in
2929
print_endline
3030
(result |> List.map Protocol.stringifyCompletionItem |> Protocol.array)

analysis/src/NewCompletions.ml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,6 @@ let processCompletable ~debug ~package ~scope ~env ~pos ~forHover
13291329
contextPath
13301330
|> getCompletionsForContextPath ~package ~opens ~rawOpens ~allFiles ~pos
13311331
~env ~exact:false ~scope
1332-
|> List.map completionToItem
13331332
| Cjsx ([id], prefix, identsSeen) when String.uncapitalize_ascii id = id ->
13341333
let mkLabel (name, typString) =
13351334
Completion.create ~name ~kind:(Label typString) ~env
@@ -1342,7 +1341,6 @@ let processCompletable ~debug ~package ~scope ~env ~pos ~forHover
13421341
Utils.startsWith name prefix && not (List.mem name identsSeen))
13431342
|> List.map mkLabel)
13441343
@ keyLabels
1345-
|> List.map completionToItem
13461344
| Cjsx (componentPath, prefix, identsSeen) ->
13471345
let labels =
13481346
match componentPath @ ["make"] |> findTypeOfValue with
@@ -1402,7 +1400,6 @@ let processCompletable ~debug ~package ~scope ~env ~pos ~forHover
14021400
&& (forHover || not (List.mem name identsSeen)))
14031401
|> List.map mkLabel)
14041402
@ keyLabels
1405-
|> List.map completionToItem
14061403
| Cdecorator prefix ->
14071404
let mkDecorator name = Completion.create ~name ~kind:(Label "") ~env in
14081405
[
@@ -1444,7 +1441,7 @@ let processCompletable ~debug ~package ~scope ~env ~pos ~forHover
14441441
else decorator
14451442
in
14461443
dec2)
1447-
|> List.map mkDecorator |> List.map completionToItem
1444+
|> List.map mkDecorator
14481445
| CnamedArg (cp, prefix, identsSeen) ->
14491446
let labels =
14501447
match
@@ -1479,4 +1476,4 @@ let processCompletable ~debug ~package ~scope ~env ~pos ~forHover
14791476
labels
14801477
|> List.filter (fun (name, _t) ->
14811478
Utils.startsWith name prefix && not (List.mem name identsSeen))
1482-
|> List.map mkLabel |> List.map completionToItem
1479+
|> List.map mkLabel

0 commit comments

Comments
 (0)