Skip to content

Commit 0ee6991

Browse files
committed
Merge branch 'topic/edge-conflict' into 'edge'
Merge master into edge and address conflicts See merge request eng/ide/ada_language_server!1733
2 parents 265bb6d + 8d024c3 commit 0ee6991

19 files changed

+600
-332
lines changed

.gitlab-ci.plan

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
def build_(qualifier={}):
2+
with defaults(qualifier=qualifier):
3+
anod_build("als")
4+
anod_build("vscode-extension")
5+
6+
7+
def test_als_(qualifier={}):
8+
with defaults(qualifier=qualifier):
9+
# Install the component built in the preceding CI build job
10+
anod_install("als")
11+
anod_test("als")
12+
13+
14+
def test_vscode_extension_(qualifier={}):
15+
with defaults(qualifier=qualifier):
16+
# Install the component built in the preceding CI build job
17+
anod_install("vscode-extension")
18+
anod_test("vscode-extension")
19+
20+
21+
def build_test_gs_(qualifier={}):
22+
with defaults(qualifier=qualifier):
23+
# Install the component built in the preceding CI build job
24+
anod_install("als")
25+
# Test gps. This will automatically rebuild gps based on the ALS changes
26+
anod_test("gps")
27+
28+
29+
# Edge
30+
31+
edge_qualifier = {"edge": True}
32+
33+
34+
def build_edge():
35+
build_(edge_qualifier)
36+
37+
38+
def test_als_edge():
39+
test_als_(edge_qualifier)
40+
41+
42+
def test_vscode_extension_edge():
43+
test_vscode_extension_(edge_qualifier)
44+
45+
46+
def build_test_gs_edge():
47+
build_test_gs_(edge_qualifier)
48+
49+
50+
# Integration testsuite (no edge version)
51+
52+
53+
def test_integration_testsuite():
54+
# The two components below have been built by the build job of the CI
55+
anod_install("als")
56+
anod_install("vscode-extension")
57+
# Install gps component to avoid it getting rebuilt. We are only interested in
58+
# vscode tests in the integration-testsuite, not gps.
59+
anod_install("gps")
60+
# Run the subset of integration-testsuite that uses VS Code
61+
anod_test(
62+
"integration-testsuite",
63+
qualifier={"run-tools": "vscode", "cleanup-mode": "none"},
64+
)

.gitlab-ci.yml

Lines changed: 54 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -1,188 +1,59 @@
11
stages:
22
- build
33
- test
4+
- optional
45
- check
5-
- run_downstream_ci
66

7-
issue-check:
8-
services:
9-
- image:e3
10-
stage: check
11-
needs: [] # Do not wait for the other stages to execute
12-
interruptible: true # Cancel job if the branch is pushed
13-
variables: # do not checkout the git repository, not needed
14-
GIT_STRATEGY: none
15-
rules: # Launch only on merge requests
16-
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
17-
script:
18-
- require_issue # launch the verification
19-
20-
.basic-setup:
21-
# Basic invocation of generic_anod_ci.
22-
- generic_anod_ci
23-
- cat /tmp/ci_env.sh
24-
- . /tmp/ci_env.sh
25-
26-
.basic-test-setup:
27-
# Use of generic_anod_ci for the purposes of testing, assuming
28-
# the presence of a package containing the build.
29-
30-
# Unpack the built package
31-
- (cd /tmp && tar -xzf $CI_PROJECT_DIR/wave-build-export.tar.gz)
32-
# Make sure to remove the package, lest it be considered source by anod
33-
- rm $CI_PROJECT_DIR/wave-build-export.tar.gz
34-
35-
# Basic invocation of generic_anod_ci.
36-
- generic_anod_ci
37-
- cat /tmp/ci_env.sh
38-
- . /tmp/ci_env.sh
39-
40-
# Use the packaged components in our sandbox
41-
- anod-copy-components /tmp/wave-build-export $ANOD_DEFAULT_SANDBOX_DIR
42-
43-
# generic_anod_ci sets the resolver to "smart_resolver" - this conflicts
44-
# with our intention to use the pre-build package(s): use the "minimal"
45-
# resolver for this.
46-
- anod tune --minimal --plan /tmp/plans
47-
48-
49-
# Build and test with ANOD
50-
# TODO: add a build and test based on Alire in parallel to this.
51-
build:
52-
services:
53-
- image:systemgtk
54-
- cpu:8
55-
stage: build
56-
interruptible: true
57-
rules:
58-
- if: $CI_PIPELINE_SOURCE == 'push'
59-
when: never
60-
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
61-
- if: $CI_PIPELINE_SOURCE == 'pipeline'
62-
script:
63-
- !reference [.basic-setup]
64-
65-
- echo -e "\e[0Ksection_start:`date +%s`:build_als[collapsed=true]\r\e[0Kanod build als"
66-
- anod build als $ACI_TRACK_QUALIFIER
67-
- echo -e "\e[0Ksection_end:`date +%s`:build_als\r\e[0K"
68-
69-
- echo -e "\e[0Ksection_start:`date +%s`:build_vscode[collapsed=true]\r\e[0Kanod build vscode-extension"
70-
# We pass --latest here because the vscode-extension will try to download
71-
# the Windows binary (it's a multi-platform extension), and this binary
72-
# might not be available right away.
73-
- anod build vscode-extension $ACI_TRACK_QUALIFIER --minimal --latest
74-
- echo -e "\e[0Ksection_end:`date +%s`:build_vscode\r\e[0K"
75-
76-
# Export the components and make a package out of them
77-
- anod-copy-components --standalone-export $ANOD_DEFAULT_SANDBOX_DIR /tmp/wave-build-export
78-
- (cd /tmp/ && tar -czf $CI_PROJECT_DIR/wave-build-export.tar.gz wave-build-export)
79-
80-
artifacts:
81-
when: on_success
82-
paths:
83-
- wave-build-export.tar.gz
84-
85-
86-
test-als:
87-
services:
88-
- image:systemgtk
89-
- cpu:8
90-
stage: test
91-
interruptible: true
92-
rules:
93-
- if: $CI_PIPELINE_SOURCE == 'push'
94-
when: never
95-
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
96-
- if: $CI_PIPELINE_SOURCE == 'pipeline'
97-
script:
98-
- !reference [.basic-test-setup]
99-
100-
- echo -e "\e[0Ksection_start:`date +%s`:test_als[collapsed=true]\r\e[0Kanod test als"
101-
# Run ALS tests
102-
- anod test als $ACI_TRACK_QUALIFIER
103-
104-
- ALS_BUILD_SPACE=$(anod info test als $ACI_TRACK_QUALIFIER --show working_dir)
105-
- echo -e "\e[0Ksection_end:`date +%s`:test_als\r\e[0K"
106-
107-
# Job artifacts must be produced in the project directory, so we do it at
108-
# the end of the job to avoid changing Anod checkouts halfway through the
109-
# job and triggering useless rebuilds.
110-
# Process the als test report
111-
- e3-testsuite-report
112-
--failure-exit-code 1
113-
--xunit-output $CI_PROJECT_DIR/als_xunit_output.xml
114-
$ALS_BUILD_SPACE/results/new/ || FAILED=true
115-
# Include Anod logs
116-
- cp -r $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
117-
118-
- if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
119-
120-
artifacts:
121-
when: always # Upload on errors too
122-
reports:
123-
junit: [als_xunit_output.xml]
124-
paths:
125-
- anod-logs/
126-
127-
test-vscode-extension:
128-
services:
129-
- image:systemgtk
130-
- cpu:8
131-
stage: test
132-
interruptible: true
133-
rules:
134-
- if: $CI_PIPELINE_SOURCE == 'push'
135-
when: never
136-
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
137-
- if: $CI_PIPELINE_SOURCE == 'pipeline'
138-
script:
139-
- !reference [.basic-test-setup]
140-
141-
# Run VSCode extension tests
142-
- echo -e "\e[0Ksection_start:`date +%s`:test_vscode[collapsed=true]\r\e[0Kanod test vscode-extension"
143-
- anod test vscode-extension $ACI_TRACK_QUALIFIER --minimal
144-
145-
- VSCODE_BUILD_SPACE=$(anod info test vscode-extension $ACI_TRACK_QUALIFIER --show working_dir)
146-
- echo -e "\e[0Ksection_end:`date +%s`:test_vscode\r\e[0K"
147-
148-
# Job artifacts must be produced in the project directory, so we do it at
149-
# the end of the job to avoid changing Anod checkouts halfway through the
150-
# job and triggering useless rebuilds.
151-
# Process the vscode-extension test report
152-
- e3-testsuite-report
153-
--failure-exit-code 1
154-
--xunit-output $CI_PROJECT_DIR/vscode_xunit_output.xml
155-
$VSCODE_BUILD_SPACE/results/ || FAILED=true
156-
# Include Anod logs
157-
- cp -r $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
158-
159-
- if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
160-
161-
artifacts:
162-
when: always # Upload on errors too
163-
reports:
164-
junit: [vscode_xunit_output.xml]
165-
paths:
166-
- anod-logs/
167-
168-
.run_ci_common: &run_ci_common
169-
stage: run_downstream_ci
170-
needs: ["test-als"]
171-
rules:
172-
- if: $CI_PIPELINE_SOURCE == 'push'
173-
when: never
174-
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
175-
when: manual
176-
allow_failure: true
177-
trigger:
178-
strategy: depend
179-
inherit:
180-
variables: false
181-
variables:
182-
ACI_UPSTREAM_PROJECT_ID: $CI_PROJECT_ID
183-
ACI_UPSTREAM_MERGE_REQUEST_IID: $CI_MERGE_REQUEST_IID
184-
185-
run_gs_ci:
186-
<<: *run_ci_common
187-
trigger:
188-
project: eng/ide/gnatstudio
7+
include:
8+
# Issue check
9+
- component: $CI_SERVER_FQDN/eng/gitlab-templates/check-issue@~latest
10+
11+
# Build
12+
- component: $CI_SERVER_FQDN/eng/gitlab-templates/build@~latest
13+
inputs:
14+
anod-args: run build_$ACI_TRACK
15+
cpus: 16
16+
image: systemgtk
17+
save-component: true
18+
19+
# Testing of the ALS
20+
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
21+
inputs:
22+
job-name: als
23+
anod-args: run test_als_$ACI_TRACK
24+
image: systemgtk
25+
26+
# Testing of the VSCode extension
27+
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
28+
inputs:
29+
job-name: vscode-extension
30+
anod-args: run test_vscode_extension_$ACI_TRACK
31+
image: systemgtk
32+
33+
# Integration testsuite
34+
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
35+
inputs:
36+
job-name: integration-testsuite
37+
# Here we would like to use --latest as to reduce issues from unavailable
38+
# components, but we can't because it breaks the transfer of built
39+
# components between jobs using anod-copy-components.
40+
#
41+
# See https://gitlab.adacore-it.com/eng/ide/ada_language_server/-/merge_requests/1611#note_610445
42+
anod-args: run test_integration_testsuite
43+
image: systemgtk
44+
cpus: 4
45+
rules:
46+
# Does not work on edge
47+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_TARGET_BRANCH_NAME != 'edge'
48+
49+
# Optional testing of GNAT Studio
50+
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
51+
inputs:
52+
job-name: gs
53+
anod-args: run build_test_gs_$ACI_TRACK
54+
image: systemgtk
55+
stage: optional
56+
rules:
57+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
58+
when: manual
59+
allow_failure: true

source/ada/lsp-ada_documents.adb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ package body LSP.Ada_Documents is
118118
Completions_Count : Natural)
119119
return LSP.Structures.CompletionItem
120120
is
121+
use Libadalang.Common;
121122

122123
package Weight_Formatters renames VSS.Strings.Formatters.Integers;
123124

@@ -307,9 +308,13 @@ package body LSP.Ada_Documents is
307308
Item.label.Append (" (invisible)");
308309
Item.filterText := Label;
309310

310-
-- If the corresponding setting is enabled, append a command to
311+
-- If the corresponding setting is enabled, and if we
312+
-- are not completing within a with-clause, append a command to
311313
-- insert the missing with-clause/qualifier.
312-
if Handler.Get_Configuration.Insert_With_Clauses then
314+
if Handler.Get_Configuration.Insert_With_Clauses
315+
and then not (for some Parent of Node.Parents
316+
=> Parent.Kind = Ada_With_Clause)
317+
then
313318
Append_Auto_Import_Command;
314319
end if;
315320
end if;

source/ada/lsp-ada_driver.adb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,16 @@ procedure LSP.Ada_Driver is
226226
Command'Tag);
227227
end Register_Commands;
228228

229-
Server_Trace : constant Trace_Handle := Create ("ALS.MAIN", From_Config);
229+
Server_Trace : constant LSP.GNATCOLL_Tracers.Tracer :=
230+
LSP.GNATCOLL_Tracers.Create ("ALS.MAIN", From_Config);
230231
-- Main trace for the LSP.
231232

232-
In_Trace : constant Trace_Handle := Create ("ALS.IN", Off);
233-
Out_Trace : constant Trace_Handle := Create ("ALS.OUT", Off);
233+
In_Trace : constant LSP.GNATCOLL_Tracers.Tracer :=
234+
LSP.GNATCOLL_Tracers.Create ("ALS.IN", Off);
235+
Out_Trace : constant LSP.GNATCOLL_Tracers.Tracer :=
236+
LSP.GNATCOLL_Tracers.Create ("ALS.OUT", Off);
234237
-- Traces that logs all input & output. For debugging purposes.
235-
Tracer : aliased LSP.GNATCOLL_Tracers.Tracer;
238+
Tracer : aliased LSP.GNATCOLL_Tracers.Server_Tracer;
236239

237240
In_Stream : aliased LSP.GNATCOLL_Trace_Streams.Output_Text_Stream;
238241
-- Output stream for logging input messages into the trace
@@ -496,8 +499,8 @@ begin
496499
end;
497500
end if;
498501

499-
In_Stream.Initialize (Server_Trace);
500-
Out_Stream.Initialize (Server_Trace);
502+
In_Stream.Initialize (Trace_Handle (Server_Trace));
503+
Out_Stream.Initialize (Trace_Handle (Server_Trace));
501504

502505
Tracer.Initialize (Server_Trace, In_Trace, Out_Trace);
503506
Tracer.Trace ("ALS version: " & $VERSION & " (" & $BUILD_DATE & ")");
@@ -558,7 +561,7 @@ begin
558561

559562
-- Load predefined completion items
560563
LSP.Predefined_Completion.Load_Predefined_Completion_Db
561-
(Server_Trace);
564+
(Trace_Handle (Server_Trace));
562565

563566
Ada_Fence_Message_Handler.Initialize
564567
(Handler => Ada_Handler'Unchecked_Access,

source/ada/lsp-ada_handlers-project_diagnostics.adb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18+
with LSP.GNATCOLL_Tracers;
1819
package body LSP.Ada_Handlers.Project_Diagnostics is
1920

21+
Tracer : constant LSP.GNATCOLL_Tracers.Tracer :=
22+
LSP.GNATCOLL_Tracers.Create ("ALS.PROJECT.DIAGNOSTICS");
23+
-- We do not activate this trace by default because it is too noisy to
24+
-- repeat the information every time diagnostics are published for every
25+
-- file.
26+
2027
--------------------
2128
-- Get_Diagnostic --
2229
--------------------
@@ -29,7 +36,8 @@ package body LSP.Ada_Handlers.Project_Diagnostics is
2936
if Self.Handler.Configuration.Project_Diagnostics_Enabled then
3037
Self.Last_Status := Self.Handler.Project_Status;
3138

32-
Self.Handler.Tracer.Trace ("Diag: " & Self.Last_Status'Image);
39+
Tracer.Trace ("Project loading status: " & Self.Last_Status'Image);
40+
3341
-- If we have a valid project return immediately: we want to display
3442
-- diagnostics only if there is an issue to solve or a potential
3543
-- enhancement.

0 commit comments

Comments
 (0)