Skip to content

Commit

Permalink
set Qed as immediately processed, set proof body as processing
Browse files Browse the repository at this point in the history
  • Loading branch information
gares committed May 31, 2024
1 parent bb4644c commit fd77091
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions language-server/dm/executionManager.ml
Original file line number Diff line number Diff line change
Expand Up @@ -251,50 +251,54 @@ let rec remove_or_truncate_range r = function
else
r1 :: (remove_or_truncate_range r l)

let update_processed_as_Done s range overview =
let {prepared; processing; processed} = overview in
match s with
| Success _ ->
log @@ "INSERTING TO PROCESSED";
let processed = insert_or_merge_range range processed in
log @@ "TRUNCATING FROM PROCESSING";
let processing = remove_or_truncate_range range processing in
log @@ "TRUNCATING FROM PREPARED";
let prepared = remove_or_truncate_range range prepared in
{prepared; processing; processed}
| Error _ ->
log @@ "TRUNCATING FROM PROCESSING";
let processing = remove_or_truncate_range range processing in
log @@ "TRUNCATING FROM PREPARED";
let prepared = remove_or_truncate_range range prepared in
{prepared; processing; processed}

let update_processed id state document overview =
log @@ "UPDATING PROCESSED";
let {prepared; processing; processed} = overview in
let range = Document.range_of_id_with_blank_space document id in
match SM.find id state.of_sentence with
| (s, _) ->
begin match s with
| Done s ->
begin match s with
| Success _ ->
log @@ "INSERTING TO PROCESSED";
let processed = insert_or_merge_range range processed in
log @@ "TRUNCATING FROM PROCESSING";
let processing = remove_or_truncate_range range processing in
log @@ "TRUNCATING FROM PREPARED";
let prepared = remove_or_truncate_range range prepared in
{prepared; processing; processed}
| Error _ ->
log @@ "TRUNCATING FROM PROCESSING";
let processing = remove_or_truncate_range range processing in
log @@ "TRUNCATING FROM PREPARED";
let prepared = remove_or_truncate_range range prepared in
{prepared; processing; processed}
end
| _ -> log @@ "TRYING TO UPDATE DELEGATED ID: " ^ Stateid.to_string id; {prepared; processing; processed}
| Done s -> update_processed_as_Done s range overview
| _ -> assert false (* delegated sentences born as such, cannot become it later *)
end
| exception Not_found ->
log @@ "Trying to get overview with non-existing state id " ^ Stateid.to_string id;
{prepared; processing; processed}
overview

let update_processing task processing prepared document =
log @@ "UPDATING PROCESSING";
match task with
| PDelegate { opener_id; terminator_id; tasks } ->
let opener_id = begin match tasks with
| [] -> opener_id
| t :: _ -> match t with
| PDelegate { opener_id } -> opener_id
| PSkip { id } | PExec { id } | PQuery { id } -> id
end
let proof_opener_id = match tasks with
| [] -> opener_id
| (PSkip { id } | PExec { id } | PQuery { id }) :: _ -> id
| PDelegate _ :: _ -> assert false
in
let proof_closer_id = match List.rev tasks with
| [] -> terminator_id
| (PSkip { id } | PExec { id } | PQuery { id }) :: _ -> id
| PDelegate _ :: _ -> assert false
in
let opener_range = Document.range_of_id_with_blank_space document opener_id in
let terminator_range = Document.range_of_id_with_blank_space document terminator_id in
let range = Range.create ~end_:terminator_range.end_ ~start:opener_range.start in
let proof_begin_range = Document.range_of_id_with_blank_space document proof_opener_id in
let proof_end_range = Document.range_of_id_with_blank_space document proof_closer_id in
let range = Range.create ~end_:proof_end_range.end_ ~start:proof_begin_range.start in
log @@ "DELEGATED JOB RANGE: " ^ Range.to_string range;
log @@ "TRUNCATING FROM PREPARED";
(* When a job is delegated we shouldn't merge ranges (to get the proper progress report) *)
Expand All @@ -307,7 +311,9 @@ let update_processing task processing prepared document =
let update_overview task todo state document overview =
let {processed; processing; prepared} =
match task with
| PDelegate _ -> overview
| PDelegate { terminator_id } ->
let range = Document.range_of_id_with_blank_space document terminator_id in
update_processed_as_Done (Success None) range overview
| PSkip { id } | PExec { id } | PQuery { id } ->
update_processed id state document overview
in
Expand Down

0 comments on commit fd77091

Please sign in to comment.