Skip to content

Commit

Permalink
Merge remote branch 'origin/master' into edge
Browse files Browse the repository at this point in the history
  • Loading branch information
automatic-merge committed Jul 17, 2024
2 parents b24852c + b858e26 commit b3be331
Show file tree
Hide file tree
Showing 613 changed files with 280 additions and 288 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ test-vscode-extension:

.run_ci_common: &run_ci_common
stage: run_downstream_ci
needs: ["test-als"]
rules:
- if: $CI_PIPELINE_SOURCE == 'push'
when: never
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ extension at
- [Install](#install)
- [Dependencies](#dependencies)
- [Usage](#usage)
- [Memory Consumption](#memory-consumption)
- [Supported LSP Server Requests](#supported-lsp-server-requests)
- [Protocol Extensions](#protocol-extensions)
- [VS Code Extension](#vs-code-extension)
Expand Down Expand Up @@ -129,6 +130,16 @@ client provides its-own way to set such settings. You can use the `--config`
option if you want to provide the configuration directly via a JSON file
instead of specifying it via the requests listed just above.

### Memory Consumption

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

## Supported LSP Server Requests

See [WiKi page](https://github.com/AdaCore/ada_language_server/wiki/Supported-LSP-requests)
Expand Down
123 changes: 14 additions & 109 deletions gnat/lsp.gpr
Original file line number Diff line number Diff line change
@@ -1,118 +1,23 @@
------------------------------------------------------------------------------
-- Language Server Protocol --
-- --
-- Copyright (C) 2018-2023, AdaCore --
-- --
-- This is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
-- License for more details. You should have received a copy of the GNU --
-- General Public License distributed with this software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
------------------------------------------------------------------------------
--
-- Copyright (C) 2018-2024, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0
--

with "gnatcoll";
with "vss_text";
with "vss_json";

project LSP is

type Any_Build_Mode is (
"prod",
-- Produce efficient code to be used in production and don't treat
-- warnings as errors.

"dev"
-- Produce easy-to-debug code with extra checks. Treat warnings as
-- errors.
);
Build_Mode : Any_Build_Mode := external ("BUILD_MODE", "dev");

Superproject := external ("SUPERPROJECT", "");

type Any_Boolean is ("false", "true");

-- By default, treat warnings as errors in dev mode, but not in prod
-- mode. Let users override this default using the ALS_WARN_ERRORS
-- environment variable.

Warnings_As_Errors : Any_Boolean := "true";
case Build_Mode is
when "dev" => Warnings_As_Errors := "true";
when "prod" => Warnings_As_Errors := "false";
end case;
Warnings_As_Errors : Any_Boolean :=
external ("ALS_WARN_ERRORS", Warnings_As_Errors);

for Source_Dirs use ("../source/protocol",
"../source/protocol/generated",
"../source/common",
"../source/uri");
for Object_Dir use "../.obj/" & Superproject & "/lsp";
for Main use ();

-- Compute the list of default switches to build Ada unit
with "lsp_base";
with "lsp_common";

Common_Ada_Switches := (
-- Generate debug information even in production: this is useful to
-- get meaningful tracebacks.
"-g",

-- Compile with "-gnatX" to support the "[]" syntax for array
-- aggregates: this is the common ground between all compilers
-- commonly used to build the language server.
"-gnatX");

Ada_Switches := ();
case Build_Mode is
when "prod" =>
Ada_Switches := (
-- Compile with optimizations
"-O2"
);

when "dev" =>
Ada_Switches := (
-- Compile with no optimization and with debug information to ease
-- investigation in debuggers.
"-O0",

-- Enable all warnings and GNAT stylechecks (plus O: check for
-- overriding indicators).
"-gnatwaJ", "-gnatygO",

-- Enable assertions and all validity checking options
"-gnata", "-gnatVa",

-- Enable stack overflow checks
"-fstack-check"
);
end case;

case Warnings_As_Errors is
when "true" => Ada_Switches := Ada_Switches & ("-gnatwe");
when "false" => null;
end case;
project LSP is

package Compiler is
for Default_Switches ("Ada") use Common_Ada_Switches & Ada_Switches;
for Local_Configuration_Pragmas use "gnat.adc";
end Compiler;
for Source_Dirs use
("../liblsp_3_16/source/",
"../liblsp_3_16/source/generated/");
for Object_Dir use "../.obj/" & LSP_Common.Superproject & "/lsp";

package Naming is
case GnatColl.OS is
when "windows" =>
for Implementation ("LSP.Stdio_Streams.Initialize")
use "lsp-stdio_streams-init_windows.adb";
package Compiler renames LSP_Common.Compiler;

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

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

with "vss_text";
with "vss_json";
with "lsp_base";
with "lsp_common";

project LSP_3_17 is

type OS_API_Kind is ("unix", "osx", "Windows_NT");
OS_API : OS_API_Kind :=
external ("LSP_OS", external ("OS", "unix"));
for Source_Dirs use
("../liblsp_3_17/source/",
"../liblsp_3_17/source/generated/");
for Object_Dir use "../.obj/" & LSP_Common.Superproject & "/lsp_317";

type Any_Build_Mode is (
"prod",
-- Produce efficient code to be used in production and don't treat
-- warnings as errors.

"dev"
-- Produce easy-to-debug code with extra checks. Treat warnings as
-- errors.
);
Build_Mode : Any_Build_Mode := external ("BUILD_MODE", "dev");

Superproject := external ("SUPERPROJECT", "");

type Any_Boolean is ("false", "true");

-- By default, treat warnings as errors in dev mode, but not in prod
-- mode. Let users override this default using the ALS_WARN_ERRORS
-- environment variable.

Warnings_As_Errors : Any_Boolean := "true";
case Build_Mode is
when "dev" => Warnings_As_Errors := "true";
when "prod" => Warnings_As_Errors := "false";
end case;
Warnings_As_Errors : Any_Boolean :=
external ("ALS_WARN_ERRORS", Warnings_As_Errors);

for Source_Dirs use ("../source/lsp_3.17",
"../source/lsp_3.17/generated",
"../source/common",
"../source/uri");
for Object_Dir use "../.obj/" & Superproject & "/lsp_317";
for Main use ();

-- Compute the list of default switches to build Ada unit

Common_Ada_Switches := (
-- Generate debug information even in production: this is useful to
-- get meaningful tracebacks.
"-g",

-- Compile with "-gnatX" to support the "[]" syntax for array
-- aggregates: this is the common ground between all compilers
-- commonly used to build the language server.
"-gnatX");

Ada_Switches := ();
case Build_Mode is
when "prod" =>
Ada_Switches := (
-- Compile with optimizations
"-O2"
);

when "dev" =>
Ada_Switches := (
-- Compile with no optimization and with debug information to ease
-- investigation in debuggers.
"-O0",

-- Enable all warnings and GNAT stylechecks (plus O: check for
-- overriding indicators).
"-gnatwaJ", "-gnatygO",

-- Generated files may contain long lines
"-gnatyM150",

-- Enable assertions and all validity checking options
"-gnata", "-gnatVa",

-- Enable stack overflow checks
"-fstack-check"
);
end case;

case Warnings_As_Errors is
when "true" => Ada_Switches := Ada_Switches & ("-gnatwe");
when "false" => null;
end case;

package Compiler is
for Default_Switches ("Ada") use Common_Ada_Switches & Ada_Switches;
package Compiler extends LSP_Common.Compiler is
for Switches ("lsp-inputs.adb") use
Common_Ada_Switches & Ada_Switches & ("-O0");
for Local_Configuration_Pragmas use "gnat.adc";
LSP_Common.Common_Ada_Switches & LSP_Common.Ada_Switches & ("-O0");
end Compiler;

package Naming is
case OS_API is
when "Windows_NT" =>
for Implementation ("LSP.Stdio_Streams.Initialize")
use "lsp-stdio_streams-init_windows.adb";

when others =>
for Implementation ("LSP.Stdio_Streams.Initialize")
use "lsp-stdio_streams-init_others.adb";

end case;
end Naming;

package Pretty_Printer is
for Default_Switches ("ada") use
("--no-align-modes",
"--no-separate-is",
"--comments-fill",
"--call-threshold=1",
"--par-threshold=2",
"--vertical-named-aggregates",
"--wide-character-encoding=8");
end Pretty_Printer;
package Pretty_Printer renames LSP_Common.Pretty_Printer;

end LSP_3_17;
21 changes: 21 additions & 0 deletions gnat/lsp_base.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--
-- Copyright (C) 2018-2024, AdaCore
--
-- SPDX-License-Identifier: Apache-2.0
--

with "vss_text";
with "vss_json";

with "lsp_common";

project LSP_Base is

for Source_Dirs use ("../liblsp_base/source/");
for Object_Dir use "../.obj/" & LSP_Common.Superproject & "/lsp_base";

package Compiler renames LSP_Common.Compiler;

package Pretty_Printer renames LSP_Common.Pretty_Printer;

end LSP_Base;
4 changes: 2 additions & 2 deletions gnat/lsp_client_glib.gpr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- Language Server Protocol --
-- --
-- Copyright (C) 2018-2021, AdaCore --
-- Copyright (C) 2018-2024, AdaCore --
-- --
-- This is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
Expand All @@ -21,7 +21,7 @@ with "spawn_glib";
project LSP_Client_Glib is

for Source_Dirs use ("../source/client");
for Object_Dir use "../.obj/" & LSP.Superproject & "/client_glib";
for Object_Dir use "../.obj/client_glib";

package Compiler renames LSP.Compiler;

Expand Down
Loading

0 comments on commit b3be331

Please sign in to comment.