Skip to content

Commit 6f4fd55

Browse files
author
Philippe Gil
committed
Merge branch 'topic/1401-completion-package' into 'master'
Implements completion request for package & attributes. Closes #1187 See merge request eng/ide/ada_language_server!1414
2 parents 4c87ca9 + e58a549 commit 6f4fd55

20 files changed

+1842
-74
lines changed

.gitlab-ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ build_and_test:
8383
- cp -r $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
8484
- echo -e "\e[0Ksection_end:`date +%s`:prepare_artifacts\r\e[0K"
8585

86+
- if [ ! -z ${FAILED+x} ]; then cat $CI_PROJECT_DIR/als_xunit_output.xml; fi
87+
- if [ ! -z ${FAILED+x} ]; then cat $CI_PROJECT_DIR/vscode_xunit_output.xml; fi
88+
8689
- if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
8790

8891
artifacts:
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
------------------------------------------------------------------------------
2+
-- Language Server Protocol --
3+
-- --
4+
-- Copyright (C) 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+
------------------------------------------------------------------------------
17+
18+
pragma Ada_2022;
19+
20+
with VSS.String_Vectors;
21+
22+
with LSP.Structures.Unwrap;
23+
24+
package body LSP.GPR_Client_Capabilities is
25+
26+
----------------
27+
-- Initialize --
28+
----------------
29+
30+
procedure Initialize
31+
(Self : in out Client_Capability'Class;
32+
Value : LSP.Structures.InitializeParams) is
33+
begin
34+
Self.Value := Value;
35+
end Initialize;
36+
37+
--------------------
38+
-- Resolve_Lazily --
39+
--------------------
40+
41+
function Resolve_Lazily (Self : Client_Capability'Class) return Boolean is
42+
use LSP.Structures.Unwrap;
43+
44+
List : constant VSS.String_Vectors.Virtual_String_Vector :=
45+
properties
46+
(resolveSupport
47+
(completionItem
48+
(completion
49+
(Self.Value.capabilities.textDocument))));
50+
51+
begin
52+
return List.Contains ("detail") and then List.Contains ("documentation");
53+
end Resolve_Lazily;
54+
55+
end LSP.GPR_Client_Capabilities;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
------------------------------------------------------------------------------
2+
-- Language Server Protocol --
3+
-- --
4+
-- Copyright (C) 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+
------------------------------------------------------------------------------
17+
18+
with LSP.Structures;
19+
20+
package LSP.GPR_Client_Capabilities is
21+
22+
type Client_Capability is tagged limited private;
23+
-- This type holds client initialization response and provides handy
24+
-- queries on the client capabilities
25+
26+
procedure Initialize
27+
(Self : in out Client_Capability'Class;
28+
Value : LSP.Structures.InitializeParams);
29+
-- Save initialize parameters
30+
31+
function Resolve_Lazily (Self : Client_Capability'Class) return Boolean;
32+
-- Returns True when resolve contains `documentation` and `details`
33+
34+
private
35+
36+
type Client_Capability is tagged limited record
37+
Value : LSP.Structures.InitializeParams;
38+
end record;
39+
40+
end LSP.GPR_Client_Capabilities;

0 commit comments

Comments
 (0)