Skip to content

Commit 7fc3e6d

Browse files
author
automatic-merge
committed
Merge remote branch 'origin/master' into edge
2 parents a5ac5f8 + f16bfec commit 7fc3e6d

File tree

10 files changed

+983
-950
lines changed

10 files changed

+983
-950
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ formatting might no succeed on incomplete/illegal code.
144144

145145
You can use the VS Code `Issue Reporter` to report issues. Just click on the `Help -> Report Issue` menu, select `An extension` for the `File on` entry and `Language Support for Ada` for the extension name. Put as many information you can in the description, like steps to reproduce, stacktraces or system information (VS Code automatically includes it by default). This will create a GitHub issue in the [Ada Language Server](https://github.com/AdaCore/ada_language_server/) repository.
146146

147+
ALS log files can be found under the `~/.als` directory (`%USERPROFILE%/.als` on Windows). Feel free to attach them on the issues, it helps a lot for further investigation, specially when the `ALS.IN` and `ALS.OUT` traces are enabled (more info about traces configuration can be found [here](doc/traces.md).)
148+
147149

148150
### Getting started
149151

doc/HACKING.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,31 @@
22

33
## Dependencies
44

5-
The Ada Language Server depends on the following:
5+
The Ada Language Server depends on a number of tools and libraries listed [on the main page](https://github.com/AdaCore/ada_language_server#dependencies).
66

7-
* VSS: https://github.com/AdaCore/VSS
8-
* (optional) ada_libfswatch: https://github.com/AdaCore/ada_libfswatch,
9-
to activate filesystem monitoring.
7+
## Coding
8+
9+
The ALS repository includes a template VS Code workspace at
10+
`.vscode/settings.json.tmpl`. This allows developers to instantiate the
11+
workspace locally and customize it to their liking, in particular the
12+
`terminal.integrated.env.<os>` setting to set `PATH` and `GPR_PROJECT_PATH` as
13+
needed to provided tools and dependencies to the development environment.
14+
15+
To instantiate the VS Code workspace, simply run `make configure`. Then open VS
16+
Code at the root of the ALS repository.
17+
18+
At the first run, the workspace will recommend installing a set of extensions
19+
including a released version of the `Language Support for Ada` extension which
20+
is produced from this repository. That allows you to work with the Ada codebase
21+
of the ALS.
22+
23+
## Building
24+
25+
To build the ALS, run:
26+
27+
```sh
28+
make
29+
```
1030

1131
## Debugging
1232

@@ -40,7 +60,7 @@ This is very useful to resolve unexpected memory consumption issues.
4060

4161
To get a symbolic backtrace you need the debug information files. For the
4262
release you can download them from
43-
[GitHub Release](https://github.com/AdaCore/ada_language_server/releases)
63+
[GitHub Release](https://github.com/AdaCore/ada_language_server/releases)
4464
Assets. Assets contain an archive per platform with the ALS
4565
executable and debug information files (`.debug` file on Linux/Windows and
4666
`.dSYM` directory for Mac OS X). Extract the debug information to the directory
@@ -84,30 +104,11 @@ To write a functional test for Ada Language Server:
84104
85105
Run `make vscode-test` to run the VS Code testsuite.
86106
87-
### VS Code grammar tests
88-
89-
The following is under `integration/vscode/ada/`.
90-
91-
The grammars under `syntaxes/` are in production. An advanced classifier for Ada
92-
is under `advanced/`; this one is not in production at the moment. The testsuite
93-
supports testing all grammars.
94-
95-
Tests for the grammars are in `testsuite_grammar`, with one test per subdirectory.
96-
97-
* To run the full testsuite, call `./run_grammar_tests.sh`
98-
* To run one individual test, pass its directory as parameter to
99-
that script, for instance `./run_grammar_tests.sh testsuite_grammar/hello`
100-
101-
To create new tests, do the following:
102-
103-
* Create a directory for it, for instance `testsuite_grammar/newtest`
104-
* Add `.ads`, `.adb` or `.gpr` sources in that directory
105-
* Run the driver: the first run will create the baselines under the form
106-
of `.snap.syntaxes` and `.snap.advanced` files.
107+
If you open the ALS repository in VS Code, it is also possible to run VS Code
108+
integration tests using the provided launch configurations:
107109
108-
The engine for the test driver is implemented using
109-
[vscode-tmgrammartest](https://github.com/PanAeon/vscode-tmgrammar-test):
110-
see the full documentation there.
110+
- `(vscode) Run testsuite 'general'`
111+
- `(vscode) Run testsuite 'gnattest'`
111112
112113
### Other tests
113114

integration/vscode/ada/test/suite/general/tasks.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ suite('GPR Tasks Provider', function () {
140140
// via project attributes
141141
const expectedCmd = `gprbuild -P ${def.configuration.projectFile} ${
142142
def.configuration.main ?? ''
143-
} -cargs -gnatef && obj/main1exec`;
143+
} -cargs -gnatef && obj/main1exec${process.platform == 'win32' ? '.exe' : ''}`;
144144

145145
assert.strictEqual(actualCmd, expectedCmd);
146146
});

scripts/replay.py

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,44 @@
11
#!/usr/bin/env python
22

3-
""" Development utility to replay the most recent trace file, and output it
4-
as protocol strings. This assumes that the trace file is in ~/.als/in.txt
5-
6-
To use this, do
7-
8-
replay.py > log
9-
10-
then you can replay at will with
3+
"""
4+
Development utility to replay an ALS session based on a log file containing
5+
the ALS.IN and ALS.OUT traces, and output it as protocol strings.
116
12-
ada_language_server < log
7+
Usage: replay.py --log-file <path_to_log_file> --output-file <output_file>
138
"""
149

15-
import os
10+
import argparse
1611
from json_transformations import python_to_protocol_string, traces_to_test
1712

18-
als_dir = os.path.join(os.path.expanduser('~'), '.als')
19-
inout_file = os.path.join(als_dir, 'inout.txt')
13+
14+
argParser = argparse.ArgumentParser()
15+
argParser.add_argument(
16+
"-l",
17+
"--log-file",
18+
help="Path to the log file containing ALS.IN and ALS.OUT traces.",
19+
required=True,
20+
)
21+
argParser.add_argument(
22+
"-o",
23+
"--output-file",
24+
help="Path to the output file containing all the ALS requests retrieved "
25+
+ "from the log file. Then you can replay a session like this: "
26+
+ "ada_language_server < <output_file>",
27+
required=False,
28+
)
29+
args = argParser.parse_args()
30+
31+
inout_file = args.log_file
32+
output_file = args.output_file
2033
test = traces_to_test(inout_file, None, True)
2134
result = ""
2235
for x in test:
2336
if "send" in x:
2437
result += python_to_protocol_string([x["send"]["request"]])
25-
print(result + "\r")
38+
39+
# Print on stdout if no output file has been specified
40+
if output_file:
41+
with open(output_file, "w") as file:
42+
file.write(result + "\r")
43+
else:
44+
print(result + "\r")

source/ada/lsp-ada_handlers-symbols.adb

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,47 @@ package body LSP.Ada_Handlers.Symbols is
302302

303303
for Child of Node.Children loop
304304
if not Child.Is_Null then
305-
Walk (Child, Next_Level, Children);
305+
Walk
306+
(Node => Child,
307+
Nested_Level => Next_Level,
308+
Vector => Children);
306309
exit when Self.Is_Canceled.all;
307310
end if;
308311
end loop;
309312

310313
case Node.Kind is
314+
when Libadalang.Common.Ada_Ada_Node_List_Range =>
315+
316+
-- Check if we are dealing with a list of with-clauses nodes
317+
-- ('namespace' symbol kind). If yes, create a 'fake' parent
318+
-- item called 'With clauses' and put every with-clause within it.
319+
if Children.Length > 0 then
320+
declare
321+
First_Item : constant LSP.Structures.DocumentSymbol :=
322+
LSP.Structures.Get_DocumentSymbol_Constant_Reference
323+
(Children, 1);
324+
Package_Deps_Item : LSP.Structures.DocumentSymbol;
325+
begin
326+
if First_Item.kind = Namespace then
327+
Package_Deps_Item :=
328+
(name => VSS.Strings.To_Virtual_String
329+
("With clauses"),
330+
detail => VSS.Strings.Empty_Virtual_String,
331+
kind => Namespace,
332+
deprecated => (Is_Set => False),
333+
tags => LSP.Constants.Empty,
334+
a_range => First_Item.a_range,
335+
selectionRange => First_Item.a_range,
336+
children => Children,
337+
others => <>);
338+
Vector.Append (Package_Deps_Item);
339+
else
340+
for J in 1 .. Children.Length loop
341+
Vector.Append (Children (J));
342+
end loop;
343+
end if;
344+
end;
345+
end if;
311346
when Libadalang.Common.Ada_Basic_Decl =>
312347
declare
313348
Decl : constant Libadalang.Analysis.Basic_Decl :=

0 commit comments

Comments
 (0)