File tree 1 file changed +10
-7
lines changed 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ let offsetOfLine text line =
23
23
let positionToOffset text (line , character ) =
24
24
match offsetOfLine text line with
25
25
| None -> None
26
- | Some bol -> Some (bol + character)
26
+ | Some bol ->
27
+ if bol + character < = String. length text then Some (bol + character)
28
+ else None
27
29
28
30
type prop = {
29
31
name : string ;
@@ -216,12 +218,7 @@ let rec exprToContextPath (e : Parsetree.expression) =
216
218
| Some contexPath -> Some (CPApply (contexPath, args |> List. map fst)))
217
219
| _ -> None
218
220
219
- let completionWithParser ~debug ~path ~posCursor ~currentFile ~text =
220
- let offset =
221
- match positionToOffset text posCursor with
222
- | Some offset -> offset
223
- | None -> assert false
224
- in
221
+ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
225
222
let offsetNoWhite = skipWhite text (offset - 1 ) in
226
223
let posNoWhite =
227
224
let line, col = posCursor in
@@ -789,3 +786,9 @@ let completionWithParser ~debug ~path ~posCursor ~currentFile ~text =
789
786
if ! found = false then if debug then Printf. printf " XXX Not found!\n " ;
790
787
! result)
791
788
else None
789
+
790
+ let completionWithParser ~debug ~path ~posCursor ~currentFile ~text =
791
+ match positionToOffset text posCursor with
792
+ | Some offset ->
793
+ completionWithParser1 ~current File ~debug ~offset ~path ~pos Cursor ~text
794
+ | None -> None
You can’t perform that action at this time.
0 commit comments