This repository was archived by the owner on Apr 24, 2021. It is now read-only.
File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -149,24 +149,25 @@ let findCompletable text offset =
149
149
Cjsx (Str. split (Str. regexp_string " ." ) componentName, id) )
150
150
| _ -> Cpath parts
151
151
in
152
+ let suffix i = String. sub text (i + 1 ) (offset - (i + 1 )) in
152
153
let rec loop i =
153
154
match i < 0 with
154
- | true -> Some (mkPath (String. sub text (i + 1 ) (offset - (i + 1 )) ))
155
+ | true -> Some (mkPath (suffix i ))
155
156
| false -> (
156
157
match text.[i] with
157
158
| '>' when i > 0 && text.[i - 1 ] = '-' ->
158
- let rest = String. sub text (i + 1 ) (offset - (i + 1 )) in
159
+ let rest = suffix i in
159
160
if isLowercaseIdent rest then loop (i - 2 ) else Some (mkPath rest)
160
161
| '~' ->
161
- let labelPrefix = String. sub text (i + 1 ) (offset - (i + 1 )) in
162
+ let labelPrefix = suffix i in
162
163
let funPath = findCallFromArgument text (i - 1 ) in
163
164
Some (Clabel (funPath, labelPrefix))
164
- | '@' -> Some (Cdecorator (String. sub text (i + 1 ) (offset - (i + 1 )) ))
165
+ | '@' -> Some (Cdecorator (suffix i ))
165
166
| 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '.' | '_' -> loop (i - 1 )
166
167
| _ -> (
167
168
match i = offset - 1 with
168
169
| true -> None
169
- | false -> Some (mkPath (String. sub text (i + 1 ) (offset - (i + 1 )) )) )
170
+ | false -> Some (mkPath (suffix i )) )
170
171
)
171
172
in
172
173
if offset > String. length text || offset = 0 then None else loop (offset - 1 )
You can’t perform that action at this time.
0 commit comments