@@ -63,16 +63,16 @@ let findJsxContext text offset =
63
63
match text.[i] with
64
64
| '}' -> (
65
65
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 )
67
67
| ')' -> (
68
68
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 )
70
70
| ']' -> (
71
71
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 )
73
73
| '"' -> (
74
74
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 )
76
76
| _ ->
77
77
let i1 = startOfLident text i in
78
78
let ident = String. sub text i1 (i - i1 + 1 ) in
@@ -103,19 +103,18 @@ let findJsxContext text offset =
103
103
let i = skipWhite text (i - 1 ) in
104
104
let i1 = startOfLident text i in
105
105
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 ))
107
107
| _ -> None
108
108
else None
109
109
in
110
110
loop offset
111
111
112
112
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" *)
119
118
120
119
let isLowercaseIdent id =
121
120
let rec loop i =
@@ -146,7 +145,7 @@ let findCompletable text offset =
146
145
match findJsxContext text (offset - len - 1 ) with
147
146
| None -> Cpath parts
148
147
| Some componentName ->
149
- Cjsx (Str. split (Str. regexp_string " ." ) componentName, id) )
148
+ Cjsx (Str. split (Str. regexp_string " ." ) componentName, id))
150
149
| _ -> Cpath parts
151
150
in
152
151
let suffix i = String. sub text (i + 1 ) (offset - (i + 1 )) in
@@ -156,8 +155,8 @@ let findCompletable text offset =
156
155
| false -> (
157
156
match text.[i] with
158
157
| '>' 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)
161
160
| '~' ->
162
161
let labelPrefix = suffix i in
163
162
let funPath = findCallFromArgument text (i - 1 ) in
@@ -167,8 +166,7 @@ let findCompletable text offset =
167
166
| _ -> (
168
167
match i = offset - 1 with
169
168
| true -> None
170
- | false -> Some (mkPath (suffix i)) )
171
- )
169
+ | false -> Some (mkPath (suffix i))))
172
170
in
173
171
if offset > String. length text || offset = 0 then None else loop (offset - 1 )
174
172
@@ -212,7 +210,7 @@ let findOpens text offset =
212
210
&& not (insideLineComment text (at - 4 ))
213
211
then (
214
212
add (String. sub text (i + 1 ) (i0 + 1 - (i + 1 )));
215
- at - 4 )
213
+ at - 4 )
216
214
else at
217
215
| _ -> i
218
216
in
@@ -231,7 +229,7 @@ let findOpens text offset =
231
229
| 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' ->
232
230
let i0 = startOfLident text (i - 3 ) in
233
231
add (String. sub text i0 (i - i0 - 1 ))
234
- | _ -> loop (i - 1 ) )
232
+ | _ -> loop (i - 1 ))
235
233
| _ ->
236
234
if i > 1 && text.[i] = '/' && text.[i - 1 ] = '*' then
237
235
loop (findOpenComment text (i - 2 ))
@@ -250,8 +248,8 @@ let offsetOfLine text line =
250
248
| '\n' -> (
251
249
match lno = line - 1 with
252
250
| 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)
255
253
in
256
254
match line = 0 with true -> Some 0 | false -> loop 0 0
257
255
0 commit comments