Skip to content

Commit b3be331

Browse files
author
automatic-merge
committed
Merge remote branch 'origin/master' into edge
2 parents b24852c + b858e26 commit b3be331

File tree

613 files changed

+280
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

613 files changed

+280
-288
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ test-vscode-extension:
167167

168168
.run_ci_common: &run_ci_common
169169
stage: run_downstream_ci
170+
needs: ["test-als"]
170171
rules:
171172
- if: $CI_PIPELINE_SOURCE == 'push'
172173
when: never

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ extension at
4343
- [Install](#install)
4444
- [Dependencies](#dependencies)
4545
- [Usage](#usage)
46+
- [Memory Consumption](#memory-consumption)
4647
- [Supported LSP Server Requests](#supported-lsp-server-requests)
4748
- [Protocol Extensions](#protocol-extensions)
4849
- [VS Code Extension](#vs-code-extension)
@@ -129,6 +130,16 @@ client provides its-own way to set such settings. You can use the `--config`
129130
option if you want to provide the configuration directly via a JSON file
130131
instead of specifying it via the requests listed just above.
131132

133+
### Memory Consumption
134+
135+
The `ada_language_server` relies on [Libadalang](https://github.com/AdaCore/libadalang) to compute the cross references.
136+
Most of this computation is done while indexing which will create an internal cache.
137+
The expected memory size of this cache is around 300Mb per 100k lines of Ada code.
138+
Furthermore, 450Mb are necessary for the runtime.
139+
Please note that some Ada structures like generics and tagged types might
140+
increase the memory usage. This is also the case when using aggregate projects.
141+
These measures were taken using both Resident Set Size and [Valgrind massif](https://valgrind.org/docs/manual/ms-manual.html) on Ubuntu 22.04LTS.
142+
132143
## Supported LSP Server Requests
133144

134145
See [WiKi page](https://github.com/AdaCore/ada_language_server/wiki/Supported-LSP-requests)

gnat/lsp.gpr

Lines changed: 14 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,23 @@
1-
------------------------------------------------------------------------------
2-
-- Language Server Protocol --
3-
-- --
4-
-- Copyright (C) 2018-2023, AdaCore --
5-
-- --
6-
-- This is free software; you can redistribute it and/or modify it under --
7-
-- terms of the GNU General Public License as published by the Free Soft- --
8-
-- ware Foundation; either version 3, or (at your option) any later ver- --
9-
-- sion. This software is distributed in the hope that it will be useful, --
10-
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
11-
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
12-
-- License for more details. You should have received a copy of the GNU --
13-
-- General Public License distributed with this software; see file --
14-
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
15-
-- of the license. --
16-
------------------------------------------------------------------------------
1+
--
2+
-- Copyright (C) 2018-2024, AdaCore
3+
--
4+
-- SPDX-License-Identifier: Apache-2.0
5+
--
176

187
with "gnatcoll";
19-
with "vss_text";
20-
with "vss_json";
218

22-
project LSP is
23-
24-
type Any_Build_Mode is (
25-
"prod",
26-
-- Produce efficient code to be used in production and don't treat
27-
-- warnings as errors.
28-
29-
"dev"
30-
-- Produce easy-to-debug code with extra checks. Treat warnings as
31-
-- errors.
32-
);
33-
Build_Mode : Any_Build_Mode := external ("BUILD_MODE", "dev");
34-
35-
Superproject := external ("SUPERPROJECT", "");
36-
37-
type Any_Boolean is ("false", "true");
38-
39-
-- By default, treat warnings as errors in dev mode, but not in prod
40-
-- mode. Let users override this default using the ALS_WARN_ERRORS
41-
-- environment variable.
42-
43-
Warnings_As_Errors : Any_Boolean := "true";
44-
case Build_Mode is
45-
when "dev" => Warnings_As_Errors := "true";
46-
when "prod" => Warnings_As_Errors := "false";
47-
end case;
48-
Warnings_As_Errors : Any_Boolean :=
49-
external ("ALS_WARN_ERRORS", Warnings_As_Errors);
50-
51-
for Source_Dirs use ("../source/protocol",
52-
"../source/protocol/generated",
53-
"../source/common",
54-
"../source/uri");
55-
for Object_Dir use "../.obj/" & Superproject & "/lsp";
56-
for Main use ();
57-
58-
-- Compute the list of default switches to build Ada unit
9+
with "lsp_base";
10+
with "lsp_common";
5911

60-
Common_Ada_Switches := (
61-
-- Generate debug information even in production: this is useful to
62-
-- get meaningful tracebacks.
63-
"-g",
64-
65-
-- Compile with "-gnatX" to support the "[]" syntax for array
66-
-- aggregates: this is the common ground between all compilers
67-
-- commonly used to build the language server.
68-
"-gnatX");
69-
70-
Ada_Switches := ();
71-
case Build_Mode is
72-
when "prod" =>
73-
Ada_Switches := (
74-
-- Compile with optimizations
75-
"-O2"
76-
);
77-
78-
when "dev" =>
79-
Ada_Switches := (
80-
-- Compile with no optimization and with debug information to ease
81-
-- investigation in debuggers.
82-
"-O0",
83-
84-
-- Enable all warnings and GNAT stylechecks (plus O: check for
85-
-- overriding indicators).
86-
"-gnatwaJ", "-gnatygO",
87-
88-
-- Enable assertions and all validity checking options
89-
"-gnata", "-gnatVa",
90-
91-
-- Enable stack overflow checks
92-
"-fstack-check"
93-
);
94-
end case;
95-
96-
case Warnings_As_Errors is
97-
when "true" => Ada_Switches := Ada_Switches & ("-gnatwe");
98-
when "false" => null;
99-
end case;
12+
project LSP is
10013

101-
package Compiler is
102-
for Default_Switches ("Ada") use Common_Ada_Switches & Ada_Switches;
103-
for Local_Configuration_Pragmas use "gnat.adc";
104-
end Compiler;
14+
for Source_Dirs use
15+
("../liblsp_3_16/source/",
16+
"../liblsp_3_16/source/generated/");
17+
for Object_Dir use "../.obj/" & LSP_Common.Superproject & "/lsp";
10518

106-
package Naming is
107-
case GnatColl.OS is
108-
when "windows" =>
109-
for Implementation ("LSP.Stdio_Streams.Initialize")
110-
use "lsp-stdio_streams-init_windows.adb";
19+
package Compiler renames LSP_Common.Compiler;
11120

112-
when others =>
113-
for Implementation ("LSP.Stdio_Streams.Initialize")
114-
use "lsp-stdio_streams-init_others.adb";
21+
package Pretty_Printer renames LSP_Common.Pretty_Printer;
11522

116-
end case;
117-
end Naming;
11823
end LSP;

gnat/lsp_3_17.gpr

Lines changed: 14 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,24 @@
1-
------------------------------------------------------------------------------
2-
-- Language Server Protocol --
3-
-- --
4-
-- Copyright (C) 2018-2023, AdaCore --
5-
-- --
6-
-- This is free software; you can redistribute it and/or modify it under --
7-
-- terms of the GNU General Public License as published by the Free Soft- --
8-
-- ware Foundation; either version 3, or (at your option) any later ver- --
9-
-- sion. This software is distributed in the hope that it will be useful, --
10-
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
11-
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
12-
-- License for more details. You should have received a copy of the GNU --
13-
-- General Public License distributed with this software; see file --
14-
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
15-
-- of the license. --
16-
------------------------------------------------------------------------------
1+
--
2+
-- Copyright (C) 2018-2024, AdaCore
3+
--
4+
-- SPDX-License-Identifier: Apache-2.0
5+
--
176

18-
with "vss_text";
19-
with "vss_json";
7+
with "lsp_base";
8+
with "lsp_common";
209

2110
project LSP_3_17 is
2211

23-
type OS_API_Kind is ("unix", "osx", "Windows_NT");
24-
OS_API : OS_API_Kind :=
25-
external ("LSP_OS", external ("OS", "unix"));
12+
for Source_Dirs use
13+
("../liblsp_3_17/source/",
14+
"../liblsp_3_17/source/generated/");
15+
for Object_Dir use "../.obj/" & LSP_Common.Superproject & "/lsp_317";
2616

27-
type Any_Build_Mode is (
28-
"prod",
29-
-- Produce efficient code to be used in production and don't treat
30-
-- warnings as errors.
31-
32-
"dev"
33-
-- Produce easy-to-debug code with extra checks. Treat warnings as
34-
-- errors.
35-
);
36-
Build_Mode : Any_Build_Mode := external ("BUILD_MODE", "dev");
37-
38-
Superproject := external ("SUPERPROJECT", "");
39-
40-
type Any_Boolean is ("false", "true");
41-
42-
-- By default, treat warnings as errors in dev mode, but not in prod
43-
-- mode. Let users override this default using the ALS_WARN_ERRORS
44-
-- environment variable.
45-
46-
Warnings_As_Errors : Any_Boolean := "true";
47-
case Build_Mode is
48-
when "dev" => Warnings_As_Errors := "true";
49-
when "prod" => Warnings_As_Errors := "false";
50-
end case;
51-
Warnings_As_Errors : Any_Boolean :=
52-
external ("ALS_WARN_ERRORS", Warnings_As_Errors);
53-
54-
for Source_Dirs use ("../source/lsp_3.17",
55-
"../source/lsp_3.17/generated",
56-
"../source/common",
57-
"../source/uri");
58-
for Object_Dir use "../.obj/" & Superproject & "/lsp_317";
59-
for Main use ();
60-
61-
-- Compute the list of default switches to build Ada unit
62-
63-
Common_Ada_Switches := (
64-
-- Generate debug information even in production: this is useful to
65-
-- get meaningful tracebacks.
66-
"-g",
67-
68-
-- Compile with "-gnatX" to support the "[]" syntax for array
69-
-- aggregates: this is the common ground between all compilers
70-
-- commonly used to build the language server.
71-
"-gnatX");
72-
73-
Ada_Switches := ();
74-
case Build_Mode is
75-
when "prod" =>
76-
Ada_Switches := (
77-
-- Compile with optimizations
78-
"-O2"
79-
);
80-
81-
when "dev" =>
82-
Ada_Switches := (
83-
-- Compile with no optimization and with debug information to ease
84-
-- investigation in debuggers.
85-
"-O0",
86-
87-
-- Enable all warnings and GNAT stylechecks (plus O: check for
88-
-- overriding indicators).
89-
"-gnatwaJ", "-gnatygO",
90-
91-
-- Generated files may contain long lines
92-
"-gnatyM150",
93-
94-
-- Enable assertions and all validity checking options
95-
"-gnata", "-gnatVa",
96-
97-
-- Enable stack overflow checks
98-
"-fstack-check"
99-
);
100-
end case;
101-
102-
case Warnings_As_Errors is
103-
when "true" => Ada_Switches := Ada_Switches & ("-gnatwe");
104-
when "false" => null;
105-
end case;
106-
107-
package Compiler is
108-
for Default_Switches ("Ada") use Common_Ada_Switches & Ada_Switches;
17+
package Compiler extends LSP_Common.Compiler is
10918
for Switches ("lsp-inputs.adb") use
110-
Common_Ada_Switches & Ada_Switches & ("-O0");
111-
for Local_Configuration_Pragmas use "gnat.adc";
19+
LSP_Common.Common_Ada_Switches & LSP_Common.Ada_Switches & ("-O0");
11220
end Compiler;
11321

114-
package Naming is
115-
case OS_API is
116-
when "Windows_NT" =>
117-
for Implementation ("LSP.Stdio_Streams.Initialize")
118-
use "lsp-stdio_streams-init_windows.adb";
119-
120-
when others =>
121-
for Implementation ("LSP.Stdio_Streams.Initialize")
122-
use "lsp-stdio_streams-init_others.adb";
123-
124-
end case;
125-
end Naming;
126-
127-
package Pretty_Printer is
128-
for Default_Switches ("ada") use
129-
("--no-align-modes",
130-
"--no-separate-is",
131-
"--comments-fill",
132-
"--call-threshold=1",
133-
"--par-threshold=2",
134-
"--vertical-named-aggregates",
135-
"--wide-character-encoding=8");
136-
end Pretty_Printer;
22+
package Pretty_Printer renames LSP_Common.Pretty_Printer;
13723

13824
end LSP_3_17;

gnat/lsp_base.gpr

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--
2+
-- Copyright (C) 2018-2024, AdaCore
3+
--
4+
-- SPDX-License-Identifier: Apache-2.0
5+
--
6+
7+
with "vss_text";
8+
with "vss_json";
9+
10+
with "lsp_common";
11+
12+
project LSP_Base is
13+
14+
for Source_Dirs use ("../liblsp_base/source/");
15+
for Object_Dir use "../.obj/" & LSP_Common.Superproject & "/lsp_base";
16+
17+
package Compiler renames LSP_Common.Compiler;
18+
19+
package Pretty_Printer renames LSP_Common.Pretty_Printer;
20+
21+
end LSP_Base;

gnat/lsp_client_glib.gpr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2018-2021, AdaCore --
4+
-- Copyright (C) 2018-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -21,7 +21,7 @@ with "spawn_glib";
2121
project LSP_Client_Glib is
2222

2323
for Source_Dirs use ("../source/client");
24-
for Object_Dir use "../.obj/" & LSP.Superproject & "/client_glib";
24+
for Object_Dir use "../.obj/client_glib";
2525

2626
package Compiler renames LSP.Compiler;
2727

0 commit comments

Comments
 (0)