Skip to content

Commit

Permalink
[fleche] update progress indicator correctly on End Of File
Browse files Browse the repository at this point in the history
Fixes #445
  • Loading branch information
ejgallego committed Nov 11, 2023
1 parent 0386eba commit e0b570d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
failed to create or update is still valid, but in the right failed
state. This is a much needed API change for a lot of use cases
(@ejgallego, #604)
- update progress indicator correctly on End Of File (@ejgallego,
#605, fixes #445)

# coq-lsp 0.1.8: Trick-or-treat
-------------------------------
Expand Down Expand Up @@ -107,7 +109,7 @@
(@ejgallego, #438, reported by David Ilcinkas)
- Fix "Error message browser becomes non-visible when there are many
goals" by using a fixed-position separated error display (@TDiazT,
#445, fixes #441)
#455, fixes #441)
- Message about workspace detection was printing the wrong file,
(@ejgallego, #444, reported by Alex Sanchez-Stern)
- Display the list of pending obligations in info panel (@ejgallego,
Expand Down
13 changes: 13 additions & 0 deletions examples/comments_end.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Definition a := 3.

(*
Boooo
Boooo
Boooo
*)

8 changes: 5 additions & 3 deletions fleche/doc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -627,16 +627,16 @@ let parse_action ~lines ~st last_tok doc_handle =
match res with
| Ok None ->
(* We actually need to fix Coq to return the location of the true file
EOF, the below trick doesn't work. That will involved updating the type
of `main_entry` *)
EOF, the below trick seems to work tho. Coq fix involves updating the
type of `Pcoq.main_entry` *)
let last_tok = Coq.Parsing.Parsable.loc doc_handle in
let last_tok = Coq.Utils.to_range ~lines last_tok in
(EOF (Yes last_tok), [], feedback, time)
| Ok (Some ast) ->
let () = if Debug.parsing then DDebug.parsed_sentence ~ast in
(Process ast, [], feedback, time)
| Error (Anomaly (_, msg)) | Error (User (None, msg)) ->
(* We don't have a better altenative :(, usually missing error loc here
(* We don't have a better alternative :(, usually missing error loc here
means an anomaly, so we stop *)
let err_range = last_tok in
let parse_diags = [ Diags.make err_range 1 msg ] in
Expand Down Expand Up @@ -828,6 +828,8 @@ let process_and_parse ~io ~target ~uri ~version doc last_tok doc_handle =
| Interrupted last_tok -> set_completion ~completed:(Stopped last_tok) doc
| Stop (completed, node) ->
let doc = add_node ~node doc in
(* See #445 *)
report_progress ~io ~doc (Completion.range completed);
set_completion ~completed doc
| Continue { state; last_tok; node } ->
let n_errors = CList.count Lang.Diagnostic.is_error node.Node.diags in
Expand Down

0 comments on commit e0b570d

Please sign in to comment.