Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Commit d25c043

Browse files
committed
reformat
1 parent b2e3cd0 commit d25c043

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

src/PartialParser.ml

+18-20
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ let findJsxContext text offset =
6363
match text.[i] with
6464
| '}' -> (
6565
let i1 = findBackSkippingCommentsAndStrings text '{' '}' (i - 1) 0 in
66-
match i1 > 0 with true -> beforeValue i1 | false -> None )
66+
match i1 > 0 with true -> beforeValue i1 | false -> None)
6767
| ')' -> (
6868
let i1 = findBackSkippingCommentsAndStrings text '(' ')' (i - 1) 0 in
69-
match i1 > 0 with true -> beforeValue i1 | false -> None )
69+
match i1 > 0 with true -> beforeValue i1 | false -> None)
7070
| ']' -> (
7171
let i1 = findBackSkippingCommentsAndStrings text '[' ']' (i - 1) 0 in
72-
match i1 > 0 with true -> beforeValue i1 | false -> None )
72+
match i1 > 0 with true -> beforeValue i1 | false -> None)
7373
| '"' -> (
7474
let i1 = findBack text '"' (i - 1) in
75-
match i1 > 0 with true -> beforeValue i1 | false -> None )
75+
match i1 > 0 with true -> beforeValue i1 | false -> None)
7676
| _ ->
7777
let i1 = startOfLident text i in
7878
let ident = String.sub text i1 (i - i1 + 1) in
@@ -103,19 +103,18 @@ let findJsxContext text offset =
103103
let i = skipWhite text (i - 1) in
104104
let i1 = startOfLident text i in
105105
let ident = String.sub text i1 (i - i1 + 1) in
106-
match ident = "" with true -> None | false -> loop (i1 - 1) )
106+
match ident = "" with true -> None | false -> loop (i1 - 1))
107107
| _ -> None
108108
else None
109109
in
110110
loop offset
111111

112112
type completable =
113-
| Cdecorator of string (* e.g. @module *)
114-
| Clabel of string list * string (* e.g. (["M", "foo"], "label") for M.foo(...~label...) *)
115-
| Cpath of string list (* e.g. ["M", "foo"] for M.foo *)
116-
| Cjsx of string list * string (* E.g. (["M", "Comp"], "id") for <M.Comp ... id *)
117-
| Cpipe of string (* E.g. "x->foo" *)
118-
113+
| Cdecorator of string (** e.g. @module *)
114+
| Clabel of string list * string (** e.g. (["M", "foo"], "label") for M.foo(...~label...) *)
115+
| Cpath of string list (** e.g. ["M", "foo"] for M.foo *)
116+
| Cjsx of string list * string (** E.g. (["M", "Comp"], "id") for <M.Comp ... id *)
117+
| Cpipe of string (** E.g. "x->foo" *)
119118

120119
let isLowercaseIdent id =
121120
let rec loop i =
@@ -146,7 +145,7 @@ let findCompletable text offset =
146145
match findJsxContext text (offset - len - 1) with
147146
| None -> Cpath parts
148147
| Some componentName ->
149-
Cjsx (Str.split (Str.regexp_string ".") componentName, id) )
148+
Cjsx (Str.split (Str.regexp_string ".") componentName, id))
150149
| _ -> Cpath parts
151150
in
152151
let suffix i = String.sub text (i + 1) (offset - (i + 1)) in
@@ -156,8 +155,8 @@ let findCompletable text offset =
156155
| false -> (
157156
match text.[i] with
158157
| '>' when i > 0 && text.[i - 1] = '-' ->
159-
let rest = suffix i in
160-
if isLowercaseIdent rest then loop (i - 2) else Some (mkPath rest)
158+
let rest = suffix i in
159+
if isLowercaseIdent rest then loop (i - 2) else Some (mkPath rest)
161160
| '~' ->
162161
let labelPrefix = suffix i in
163162
let funPath = findCallFromArgument text (i - 1) in
@@ -167,8 +166,7 @@ let findCompletable text offset =
167166
| _ -> (
168167
match i = offset - 1 with
169168
| true -> None
170-
| false -> Some (mkPath (suffix i)) )
171-
)
169+
| false -> Some (mkPath (suffix i))))
172170
in
173171
if offset > String.length text || offset = 0 then None else loop (offset - 1)
174172

@@ -212,7 +210,7 @@ let findOpens text offset =
212210
&& not (insideLineComment text (at - 4))
213211
then (
214212
add (String.sub text (i + 1) (i0 + 1 - (i + 1)));
215-
at - 4 )
213+
at - 4)
216214
else at
217215
| _ -> i
218216
in
@@ -231,7 +229,7 @@ let findOpens text offset =
231229
| 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' ->
232230
let i0 = startOfLident text (i - 3) in
233231
add (String.sub text i0 (i - i0 - 1))
234-
| _ -> loop (i - 1) )
232+
| _ -> loop (i - 1))
235233
| _ ->
236234
if i > 1 && text.[i] = '/' && text.[i - 1] = '*' then
237235
loop (findOpenComment text (i - 2))
@@ -250,8 +248,8 @@ let offsetOfLine text line =
250248
| '\n' -> (
251249
match lno = line - 1 with
252250
| true -> Some (i + 1)
253-
| false -> loop (i + 1) (lno + 1) )
254-
| _ -> loop (i + 1) lno )
251+
| false -> loop (i + 1) (lno + 1))
252+
| _ -> loop (i + 1) lno)
255253
in
256254
match line = 0 with true -> Some 0 | false -> loop 0 0
257255

0 commit comments

Comments
 (0)