Skip to content

Commit 7d1463a

Browse files
author
Mathéo Rome
committed
Merge branch 'mr/add_gpr_dependency_custom_request' into 'master'
Add a custom request to fetch dependency between gpr files projets. See merge request eng/ide/ada_language_server!2044
2 parents c73bb6b + fb4ffe1 commit 7d1463a

22 files changed

+777
-0
lines changed

doc/gpr_dependencies.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# GPR dependencies
2+
3+
## Short introduction
4+
5+
This implements the functionality 'show gpr dependencies', allowing to
6+
query all the dependencies of a given GPR file.
7+
8+
This request returns an array of items, each one containing a URI
9+
to another GPR file and the kind of dependency that binds them together.
10+
11+
The dependencies are listed in the `ALS_GPR_DependencyKind` enum below.
12+
13+
You can control whether you get the GPR files that depend on the
14+
requested GPR file or the requested GPR file's own dependencies.
15+
16+
## Capabilities
17+
18+
The `initialize` request returns `als-gpr-dependencies` in the list of
19+
supported commands if the server supports this functionality.
20+
21+
## Change description
22+
23+
We introduce four new types to represent the request parameters and results:
24+
25+
```typescript
26+
export enum ALS_GPR_DependencyKind {
27+
AGGREGATED,
28+
EXTENDED,
29+
EXTENDING,
30+
IMPORTED,
31+
}
32+
33+
export enum ALS_GprDependencyDirection {
34+
SHOW_OUTGOING= 1 /* Get the outgoing dependencies */,
35+
SHOW_INCOMING = 2 /* Get the incoming dependencies */,
36+
}
37+
38+
interface ALS_GPR_DependenciesParams {
39+
uri: DocumentUri /* The queried unit */;
40+
direction: ALS_GprDependencyDirection /* The direction in which to fetch the dependencies */;
41+
}
42+
43+
export type ALS_GPR_DependencyItem = {
44+
uri: DocumentUri /* The dependency's gpr file */;
45+
kind: ALS_GPRDependencyKind /* The dependency kind */;
46+
};
47+
```
48+
49+
And a new command `als-show-dependencies`:
50+
51+
```txt
52+
method: `workspace/executeCommand`
53+
"params": {
54+
"command": "als-gpr-dependencies",
55+
"arguments": [
56+
<ALS_GRP_DependenciesParams>
57+
]
58+
}
59+
```
60+
61+
It returns list of `ALS_GPR_DependencyItem`:
62+
63+
result: `ALS_GPR_DependencyItem[]`

source/ada/lsp-ada_driver.adb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ with LSP.Ada_Handlers.Refactor.Replace_Type;
7777
with LSP.Ada_Handlers.Refactor.Sort_Dependencies;
7878
with LSP.Ada_Handlers.Refactor.Suppress_Seperate;
7979
with LSP.Ada_Handlers.Show_Dependencies_Commands;
80+
with LSP.Ada_Handlers.GPR_Dependencies_Commands;
8081
with LSP.Ada_Handlers.Source_Dirs_Commands;
8182
with LSP.Ada_Handlers.Suspend_Executions;
8283
with LSP.Ada_Inline_Value;
@@ -194,6 +195,8 @@ procedure LSP.Ada_Driver is
194195
(LSP.Ada_Handlers.Open_ALS_Log_File_Commands.Command'Tag);
195196
LSP.Ada_Commands.Register
196197
(LSP.Ada_Handlers.Show_Dependencies_Commands.Command'Tag);
198+
LSP.Ada_Commands.Register
199+
(LSP.Ada_Handlers.GPR_Dependencies_Commands.Command'Tag);
197200
LSP.Ada_Commands.Register
198201
(LSP.Ada_Handlers.Source_Dirs_Commands.Command'Tag);
199202
LSP.Ada_Commands.Register

0 commit comments

Comments
 (0)