File tree Expand file tree Collapse file tree 4 files changed +50
-13
lines changed Expand file tree Collapse file tree 4 files changed +50
-13
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,14 @@ package body LSP.Ada_Configurations is
205
205
and then JSON (Index).Kind = Start_Object
206
206
then
207
207
Parse_Variables (Index);
208
+ Sort_Variables (1 , Variables_Names.Length);
209
+
210
+ Reload := Reload or else
211
+ Variables_Names /= Self.Variables_Names or else
212
+ Variables_Values /= Self.Variables_Values;
213
+
214
+ Self.Variables_Names := Variables_Names;
215
+ Self.Variables_Values := Variables_Values;
208
216
209
217
elsif Name = " defaultCharset"
210
218
and then JSON (Index).Kind = String_Value
@@ -288,15 +296,6 @@ package body LSP.Ada_Configurations is
288
296
289
297
Skip_Value (JSON, Index);
290
298
end loop ;
291
-
292
- Sort_Variables (1 , Variables_Names.Length);
293
-
294
- Reload := Reload or else
295
- Variables_Names /= Self.Variables_Names or else
296
- Variables_Values /= Self.Variables_Values;
297
-
298
- Self.Variables_Names := Variables_Names;
299
- Self.Variables_Values := Variables_Values;
300
299
end Parse_Ada ;
301
300
302
301
-- ------------------
Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ begin
381
381
382
382
Server.Finalize;
383
383
if Clean_ALS_Dir then
384
- pragma Assert (Clean_ALS_Dir );
384
+ Ada_Handler.Clean_Logs (ALS_Dir );
385
385
end if ;
386
386
387
387
-- Clean secondary stack up
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ with Ada.Unchecked_Deallocation;
23
23
24
24
with GNAT.OS_Lib ;
25
25
with GNATCOLL.Traces ;
26
+ with GNATCOLL.Utils ;
26
27
27
28
with VSS.Characters.Latin ;
28
29
with VSS.Strings.Formatters.Integers ;
@@ -216,6 +217,34 @@ package body LSP.Ada_Handlers is
216
217
end if ;
217
218
end Clean_Diagnostics ;
218
219
220
+ -- --------------
221
+ -- Clean_Logs --
222
+ -- --------------
223
+
224
+ procedure Clean_Logs
225
+ (Self : access Message_Handler'Class;
226
+ Dir : GNATCOLL.VFS.Virtual_File)
227
+ is
228
+ use GNATCOLL.VFS;
229
+ Files : File_Array_Access := Read_Dir (Dir, Files_Only);
230
+ Dummy : Boolean;
231
+ Cpt : Integer := 0 ;
232
+ begin
233
+ Sort (Files.all );
234
+ -- Browse the log files in reverse timestamp order
235
+ for F of reverse Files.all loop
236
+ -- Filter out files like traces.cfg
237
+ if GNATCOLL.Utils.Ends_With (+F.Base_Name, " .log" ) then
238
+ Cpt := Cpt + 1 ;
239
+ -- Delete the old logs
240
+ if Cpt > Self.Configuration.Log_Threshold then
241
+ Delete (F, Dummy);
242
+ end if ;
243
+ end if ;
244
+ end loop ;
245
+ Unchecked_Free (Files);
246
+ end Clean_Logs ;
247
+
219
248
-- ---------------------
220
249
-- Contexts_For_File --
221
250
-- ---------------------
Original file line number Diff line number Diff line change @@ -87,9 +87,9 @@ package LSP.Ada_Handlers is
87
87
return LSP.Structures.ProgressToken;
88
88
-- Return an unique token for indicating progress
89
89
90
- -- --------------------------
91
- -- Open Document Manger --
92
- -- --------------------------
90
+ -- ---------------------------
91
+ -- Open Document Manager --
92
+ -- ---------------------------
93
93
94
94
function Get_Open_Document
95
95
(Self : in out Message_Handler;
@@ -125,6 +125,15 @@ package LSP.Ada_Handlers is
125
125
-- If the document is not opened, then it returns a
126
126
-- OptionalVersionedTextDocumentIdentifier with a null version.
127
127
128
+ -- ---------------
129
+ -- Log Manager --
130
+ -- ---------------
131
+
132
+ procedure Clean_Logs
133
+ (Self : access Message_Handler'Class;
134
+ Dir : GNATCOLL.VFS.Virtual_File);
135
+ -- Remove the oldest logs in Dir
136
+
128
137
private
129
138
130
139
type Load_Project_Status is
You can’t perform that action at this time.
0 commit comments