Skip to content

Commit

Permalink
Merge remote branch 'origin/master' into edge
Browse files Browse the repository at this point in the history
  • Loading branch information
automatic-merge committed Jun 18, 2024
2 parents 62c9b99 + 1b943ec commit 39f5af4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion source/ada/lsp-ada_indexing.ads
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private

overriding function Priority
(Self : Indexing_Job) return LSP.Server_Jobs.Job_Priority is
(LSP.Server_Jobs.Low);
(LSP.Server_Jobs.Lowest);

overriding procedure Execute
(Self : in out Indexing_Job;
Expand Down
15 changes: 10 additions & 5 deletions source/server/lsp-job_schedulers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ package body LSP.Job_Schedulers is
end if;

if Job.Priority = Fence then
-- Process other jobs before any Fence job
while (for some List of Self.Jobs => not List.Is_Empty) loop
Self.Process_Job (Client, Waste);
-- Process other jobs (excluding indexing) before any Fence job
while
(for some List of Self.Jobs (Low .. High) => not List.Is_Empty)
loop
Self.Process_Job (Client, Waste, From => Low);

if Waste.Assigned then
return;
Expand Down Expand Up @@ -163,14 +165,17 @@ package body LSP.Job_Schedulers is
(Self : in out Job_Scheduler'Class;
Client :
in out LSP.Client_Message_Receivers.Client_Message_Receiver'Class;
Waste : out LSP.Server_Messages.Server_Message_Access)
Waste : out LSP.Server_Messages.Server_Message_Access;
From : LSP.Server_Jobs.Job_Priority := LSP.Server_Jobs.Lowest)
is
Status : LSP.Server_Jobs.Execution_Status;
begin
Self.Complete_Last_Fence_Job (null, Waste);

if not Waste.Assigned then
for List of reverse Self.Jobs when not List.Is_Empty loop
for List of reverse Self.Jobs (From .. LSP.Server_Jobs.High)
when not List.Is_Empty
loop
declare
Job : LSP.Server_Jobs.Server_Job_Access := List.First_Element;
begin
Expand Down
8 changes: 4 additions & 4 deletions source/server/lsp-job_schedulers.ads
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ package LSP.Job_Schedulers is
(Self : in out Job_Scheduler'Class;
Client :
in out LSP.Client_Message_Receivers.Client_Message_Receiver'Class;
Waste : out LSP.Server_Messages.Server_Message_Access);
-- Execute (already created) jobs with ordinal priority (Low, High).
Waste : out LSP.Server_Messages.Server_Message_Access;
From : LSP.Server_Jobs.Job_Priority := LSP.Server_Jobs.Lowest);
-- Execute (already created) jobs with ordinal priority (From .. High).
-- When a job is done the routine returns (in Waste) the message to be
-- deallocated by the server. The Client is used to send messages during
-- the execution of the job.
Expand All @@ -88,8 +89,7 @@ private
package Job_Lists is new Ada.Containers.Doubly_Linked_Lists
(LSP.Server_Jobs.Server_Job_Access, LSP.Server_Jobs."=");

subtype Ordinal_Priority is LSP.Server_Jobs.Job_Priority
range LSP.Server_Jobs.Low .. LSP.Server_Jobs.High;
subtype Ordinal_Priority is LSP.Server_Jobs.Ordinal_Priority;

type Job_List_Array is array (Ordinal_Priority) of Job_Lists.List;

Expand Down
5 changes: 3 additions & 2 deletions source/server/lsp-server_jobs.ads
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ with LSP.Server_Messages;
package LSP.Server_Jobs is
pragma Preelaborate;

type Job_Priority is (Low, High, Immediate, Fence);
type Job_Priority is (Lowest, Low, High, Immediate, Fence);
-- Job priority to schedule jobs.
--
-- @value Lowest - indexing jobs
-- @value Low - long running jobs like find-all-references
-- @value High - fast queries like hover
-- @value Immediate - urgent queries like cancel-request
Expand All @@ -33,7 +34,7 @@ package LSP.Server_Jobs is
-- new messages until the job is done. Server execute each job in its
-- queue before executing any Fence job.

subtype Ordinal_Priority is Job_Priority range Low .. High;
subtype Ordinal_Priority is Job_Priority range Lowest .. High;

type Server_Job is limited interface;

Expand Down
6 changes: 5 additions & 1 deletion source/server/lsp-servers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,10 @@ package body LSP.Servers is
end;
end select;
end loop;
exception
when E : others =>
-- Message handler should never raise any exception
Server.Tracer.Trace_Exception (E, "Execute_Jobs raised error!");
end Execute_Jobs;

---------------------
Expand Down Expand Up @@ -884,7 +888,7 @@ package body LSP.Servers is
exception
when E : others =>
-- Message handler should never raise any exception
Server.Tracer.Trace_Exception (E, "Message handler raised error!");
Server.Tracer.Trace_Exception (E, "Process_Message raised error!");
end Process_Message;

Request : Server_Message_Access;
Expand Down

0 comments on commit 39f5af4

Please sign in to comment.