@@ -32,6 +32,8 @@ package body LSP.Ada_Documents.Source_Info_Diagnostics is
3232
3333 Current_Project_Stamp : constant LSP.Ada_Handlers.Project_Stamp :=
3434 Self.Handler.Get_Project_Stamp;
35+ Is_Enabled : constant Boolean :=
36+ Self.Handler.Source_Info_Diagnostics_Enabled;
3537 begin
3638 -- The project has been reloaded: compute source information diagnostics
3739 -- again since the set of source files might have been changed.
@@ -40,15 +42,23 @@ package body LSP.Ada_Documents.Source_Info_Diagnostics is
4042 return True;
4143 end if ;
4244
45+ -- The 'sourceInfoDiagnostics' option has just changed: always return
46+ -- True in this case (e.g: to clear any existing diagnostic when the
47+ -- option gets disabled)
48+ if Self.Enabled /= Is_Enabled then
49+ Self.Enabled := Is_Enabled;
50+ return True;
51+ end if ;
52+
4353 return False;
4454 end Has_New_Diagnostic ;
4555
46- -- ------------------
56+ -- -------------------
4757 -- Get_Diagnostics --
48- -- ------------------
58+ -- -------------------
4959
5060 overriding
51- procedure Get_Diagnostic
61+ procedure Get_Diagnostics
5262 (Self : in out Diagnostic_Source;
5363 Context : LSP.Ada_Contexts.Context;
5464 Errors : out LSP.Structures.Diagnostic_Vector)
@@ -57,7 +67,7 @@ package body LSP.Ada_Documents.Source_Info_Diagnostics is
5767 -- If the unit associated to the document belongs to the fallback context
5868 -- it means that the document's file does not belong the loaded project:
5969 -- emit a hint diagnostic in that case.
60- if Context.Is_Fallback_Context then
70+ if Self.Is_Enabled and then Context.Is_Fallback_Context then
6171 declare
6272 Diag_Msg : constant String :=
6373 (if Self.Handler.Get_Project_Status.Is_Project_Loaded
@@ -78,7 +88,7 @@ package body LSP.Ada_Documents.Source_Info_Diagnostics is
7888 others => <>));
7989 end ;
8090 end if ;
81- end Get_Diagnostic ;
91+ end Get_Diagnostics ;
8292
8393 -- --------------
8494 -- Is_Enabled --
0 commit comments