Skip to content

Commit 313b40b

Browse files
committed
Merge branch 'v8.17' into v8.16
2 parents e492fc8 + 2b07f6a commit 313b40b

File tree

5 files changed

+27
-11
lines changed

5 files changed

+27
-11
lines changed

CHANGES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
- Set Coq library name correctly (@ejgallego, #260)
2929
- `_CoqProject` file is now detected using LSP client `rootPath`
3030
(@ejgallego, #261)
31-
- Press `\` to trigger Unicode completion by the server. This
32-
behavior is configurable, with "off", "regular", and extended
31+
- You can press `\` to trigger Unicode completion by the server. This
32+
behavior is configurable, with "off", "regular", and "extended"
3333
settings (@artagnon, @Alizter, ejgallego, #219).
3434

3535
# coq-lsp 0.1.3: Event

controller/rq_completion.ml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,19 @@ let unicode_list point : Yojson.Safe.t list =
6262
(* Coq's CList.map is tail-recursive *)
6363
CList.map (mk_unicode_completion_item point) ulist
6464

65+
let get_line_at_point ~(doc : Fleche.Doc.t) ~point =
66+
(* Guard against bad line number *)
67+
let line, _char = point in
68+
let line = min line doc.contents.last.line in
69+
let line = Array.get doc.contents.lines line in
70+
if Fleche.Debug.completion then Lsp.Io.trace "completion" ("line: " ^ line);
71+
line
72+
6573
let get_char_at_point ~(doc : Fleche.Doc.t) ~point =
66-
let line, char = point in
74+
let _line, char = point in
6775
if char >= 1 then (
6876
let char = char - 1 in
69-
let line = Array.get doc.contents.lines line in
70-
if Fleche.Debug.completion then Lsp.Io.trace "completion" ("line: " ^ line);
77+
let line = get_line_at_point ~doc ~point in
7178
let index = Fleche.Utf8.byte_of_char ~line ~char in
7279
if Fleche.Debug.completion then
7380
Lsp.Io.trace "completion" ("index: " ^ string_of_int index);

coq-lsp.opam

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ depends: [
2626
"yojson" { >= "1.7.0" }
2727

2828
# Uncomment this for releases
29-
"coq" { >= "8.16.0" & < "8.17" }
30-
"coq-serapi" { >= "8.16.0+0.16.2" & < "8.17" }
31-
"camlp-streams" { >= "5.0" }
29+
"coq" { >= "8.17" < "8.18" }
30+
"coq-serapi" { >= "8.17+rc1+0.17.1" < "8.18" }
3231
]
3332

3433
build: [ [ "dune" "build" "-p" name "-j" jobs ] ]

editor/code/CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33

44
- The keybinding alt+enter in VSCode is now correctly scoped to be
55
only active on Coq files.
6-
- Display an error message when VSCoq is detected to be active, as
7-
they won't work well together.
6+
- Display an error message when the VSCoq extension is detected to be
7+
active, as `coq-lsp` and VSCoq don't work well together.
8+
- Display an error message when the client and server versions don't
9+
match.
810
- [server-side] Support Unicode files
11+
- [server-side] Unicode completion on `\`, configurable in settings.
12+
- New infoview panel based on React.
13+
- New option in settings to enable Coq Debug mode (and backtraces)
14+
- Fixes a bug that made some `CoqProject` files not to be properly
15+
detected.
916

1017
# coq-lsp 0.1.3: Event
1118
----------------------

fleche/utf8.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ let rec nth_aux s i n = if n = 0 then i else nth_aux s (next s i) (n - 1)
4545
let nth s n = nth_aux s 0 n
4646

4747
(* end of camomille *)
48+
49+
(* That's a tricky one, if the char we are requesting is out of bounds, then we
50+
return the last index, 0 in the case line is empty. *)
4851
let byte_of_char ~line ~char =
4952
let ll = length line in
50-
if ll <= char then ll else nth line char
53+
if ll <= char then if ll = 0 then 0 else nth line ll - 1 else nth line char
5154

5255
let find_char line byte =
5356
let rec f index n_chars =

0 commit comments

Comments
 (0)