Skip to content

Commit 330f2ef

Browse files
BoulangerAnthonyLeonardoGracio
authored andcommitted
Trace to deactivate project diagnostics
For eng/ide/ada_language_server#1423
1 parent 814c6a3 commit 330f2ef

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

source/ada/lsp-ada_handlers-project_diagnostics.adb

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18+
with GNATCOLL.Traces; use GNATCOLL.Traces;
19+
1820
package body LSP.Ada_Handlers.Project_Diagnostics is
1921

22+
Me : constant Trace_Handle := Create ("ALS.PROJECT.DIAGNOSTICS", On);
23+
2024
--------------------
2125
-- Get_Diagnostic --
2226
--------------------
@@ -26,15 +30,17 @@ package body LSP.Ada_Handlers.Project_Diagnostics is
2630
Context : LSP.Ada_Contexts.Context;
2731
Errors : out LSP.Structures.Diagnostic_Vector) is
2832
begin
29-
Self.Last_Status := Self.Handler.Project_Status;
33+
if Me.Active then
34+
Self.Last_Status := Self.Handler.Project_Status;
3035

31-
Self.Handler.Tracer.Trace ("Diag: " & Self.Last_Status'Image);
32-
-- If we have a valid project return immediately: we want to display
33-
-- diagnostics only if there is an issue to solve or a potential
34-
-- enhancement.
36+
Self.Handler.Tracer.Trace ("Diag: " & Self.Last_Status'Image);
37+
-- If we have a valid project return immediately: we want to display
38+
-- diagnostics only if there is an issue to solve or a potential
39+
-- enhancement.
3540

36-
Errors.Append_Vector
37-
(LSP.Ada_Project_Loading.Get_Diagnostics (Self.Last_Status));
41+
Errors.Append_Vector
42+
(LSP.Ada_Project_Loading.Get_Diagnostics (Self.Last_Status));
43+
end if;
3844
end Get_Diagnostic;
3945

4046
------------------------
@@ -48,9 +54,13 @@ package body LSP.Ada_Handlers.Project_Diagnostics is
4854
is
4955
pragma Unreferenced (Context);
5056
begin
51-
return LSP.Ada_Project_Loading.Has_New_Diagnostics
52-
(Self.Last_Status,
53-
Self.Handler.Project_Status);
57+
if Me.Active then
58+
return LSP.Ada_Project_Loading.Has_New_Diagnostics
59+
(Self.Last_Status,
60+
Self.Handler.Project_Status);
61+
else
62+
return False;
63+
end if;
5464
end Has_New_Diagnostic;
5565

5666
end LSP.Ada_Handlers.Project_Diagnostics;

0 commit comments

Comments
 (0)