Skip to content

Commit 79c51db

Browse files
BoulangerBoulanger
authored andcommitted
Avoid using the fallback context for runtime files
For requests on the runtime files, only execute them in the fallback context if there is no other context available for it. Especially avoid indexing the runtime in the fallback context. This is saving around 600mb of RAM. For eng/ide/ada_language_server#1596
1 parent 30d7816 commit 79c51db

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

source/ada/lsp-ada_handlers.adb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,12 @@ package body LSP.Ada_Handlers is
247247
-- Check if the given file belongs to the runtime.
248248

249249
function Is_A_Source (Self : LSP.Ada_Contexts.Context) return Boolean is
250-
(Is_Runtime_File or else Self.Is_Part_Of_Project (File));
250+
((Is_Runtime_File and then not Self.Is_Fallback_Context)
251+
or else Self.Is_Part_Of_Project (File));
251252
-- Return True if File is a source of the project held by Context
253+
-- Avoid considering runtime files as sources for the fallback context,
254+
-- if there is no context available for this file then we will still
255+
-- use the fallback later.
252256

253257
Contexts : constant LSP.Ada_Context_Sets.Context_Lists.List :=
254258
(Self.Contexts.Each_Context (Is_A_Source'Unrestricted_Access));

0 commit comments

Comments
 (0)